Skip to content

Commit d9a06b0

Browse files
committed
Merge main
2 parents af7a539 + af2ddff commit d9a06b0

File tree

458 files changed

+13385
-3250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

458 files changed

+13385
-3250
lines changed

.github/actions/setup/action.yml

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,17 @@ description: |
44
55
inputs:
66
node-version:
7-
description: Node.js version
8-
required: true
9-
default: 23.11.0
7+
description: Node.js version override
108
pnpm-version:
11-
description: Pnpm version
12-
required: true
13-
default: 9.7.1
9+
description: Pnpm version override
1410
pnpm-run-install:
1511
description: Whether to run pnpm install
16-
required: false
1712
default: true
1813
pnpm-restore-cache:
1914
description: Whether to restore cache
20-
required: false
2115
default: true
2216
pnpm-install-cache-key:
23-
description: The cache key for the pnpm install cache
24-
default: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
17+
description: The cache key override for the pnpm install cache
2518

2619
outputs:
2720
pnpm-store-path:
@@ -37,15 +30,44 @@ runs:
3730
shell: bash
3831
run: sudo ethtool -K eth0 tx off rx off
3932

33+
- name: Get versions from .tool-versions or use overrides
34+
shell: bash
35+
run: |
36+
# if node-version input is provided, use it; otherwise, read from .tool-versions
37+
if [ "${{ inputs.node-version }}" ]; then
38+
echo "Node version override provided: ${{ inputs.node-version }}"
39+
echo "NODE_VERSION=${{ inputs.node-version }}" >> $GITHUB_ENV
40+
elif [ -f .tool-versions ]; then
41+
NODE_VERSION=$(grep '^nodejs ' .tool-versions | awk '{print $2}')
42+
echo "NODE_VERSION=$NODE_VERSION" >> $GITHUB_ENV
43+
echo "Node version resolved to: $NODE_VERSION"
44+
else
45+
echo "No .tool-versions file found and no node-version input provided. Invalid configuration."
46+
exit 1
47+
fi
48+
49+
# if pnpm-version input is provided, use it; otherwise, read from .tool-versions
50+
if [ "${{ inputs.pnpm-version }}" ]; then
51+
echo "Pnpm version override provided: ${{ inputs.pnpm-version }}"
52+
echo "PNPM_VERSION=${{ inputs.pnpm-version }}" >> $GITHUB_ENV
53+
elif [ -f .tool-versions ]; then
54+
PNPM_VERSION=$(grep '^pnpm ' .tool-versions | awk '{print $2}')
55+
echo "PNPM_VERSION=$PNPM_VERSION" >> $GITHUB_ENV
56+
echo "Pnpm version resolved to: $PNPM_VERSION"
57+
else
58+
echo "No .tool-versions file found and no pnpm-version input provided. Invalid configuration."
59+
exit 1
60+
fi
61+
4062
- name: Setup Node@${{ inputs.node-version }}
4163
uses: actions/setup-node@v4
4264
with:
43-
node-version: ${{ inputs.node-version }}
65+
node-version: ${{ env.NODE_VERSION }}
4466

4567
- name: Install pnpm
4668
uses: pnpm/action-setup@v4
4769
with:
48-
version: ${{ inputs.pnpm-version }}
70+
version: ${{ env.PNPM_VERSION }}
4971
run_install: false
5072

5173
- name: Get pnpm store path
@@ -55,14 +77,25 @@ runs:
5577
echo "STORE_PATH=$STORE_PATH" >> $GITHUB_ENV
5678
echo "Pnpm store path resolved to: $STORE_PATH"
5779
80+
- name: Compute Cache Key
81+
shell: bash
82+
run: |
83+
if [ -n "${{ inputs.pnpm-install-cache-key }}" ]; then
84+
PNPM_INSTALL_CACHE_KEY="${{ inputs.pnpm-install-cache-key }}"
85+
else
86+
PNPM_INSTALL_CACHE_KEY="pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
87+
fi
88+
echo "Computed PNPM_INSTALL_CACHE_KEY: $PNPM_INSTALL_CACHE_KEY"
89+
echo "PNPM_INSTALL_CACHE_KEY=$PNPM_INSTALL_CACHE_KEY" >> $GITHUB_ENV
90+
5891
- name: Restore pnpm install cache
5992
if: ${{ inputs.pnpm-restore-cache == 'true' }}
6093
uses: actions/cache@v4
6194
with:
6295
path: ${{ env.STORE_PATH }}
63-
key: ${{ inputs.pnpm-install-cache-key }}
96+
key: ${{ env.PNPM_INSTALL_CACHE_KEY }}
6497
restore-keys: |
65-
pnpm-store-${{ inputs.pnpm-version }}-
98+
pnpm-store-${{ env.PNPM_VERSION }}-
6699
pnpm-store-
67100
68101
- name: Run pnpm install
@@ -72,5 +105,5 @@ runs:
72105

73106
# Set the cache key output
74107
- run: |
75-
echo "pnpm-install-cache-key=${{ inputs.pnpm-install-cache-key }}" >> $GITHUB_ENV
108+
echo "pnpm-install-cache-key=${{ env.PNPM_INSTALL_CACHE_KEY }}" >> $GITHUB_OUTPUT
76109
shell: bash
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
severity=${1:-"critical"}
4+
audit_json=$(pnpm audit --prod --json)
5+
output_file="audit_output.json"
6+
7+
echo "Auditing for ${severity} vulnerabilities..."
8+
9+
echo "${audit_json}" | jq --arg severity "${severity}" '
10+
.advisories | to_entries |
11+
map(select(.value.patched_versions != "<0.0.0" and .value.severity == $severity) |
12+
{
13+
package: .value.module_name,
14+
vulnerable: .value.vulnerable_versions,
15+
fixed_in: .value.patched_versions
16+
}
17+
)
18+
' >$output_file
19+
20+
audit_length=$(jq 'length' $output_file)
21+
22+
if [[ "${audit_length}" -gt "0" ]]; then
23+
echo "Actionable vulnerabilities found in the following packages:"
24+
jq -r '.[] | "\u001b[1m\(.package)\u001b[0m vulnerable in \u001b[31m\(.vulnerable)\u001b[0m fixed in \u001b[32m\(.fixed_in)\u001b[0m"' $output_file | while read -r line; do echo -e "$line"; done
25+
echo "Output written to ${output_file}"
26+
exit 1
27+
else
28+
echo "No actionable vulnerabilities"
29+
exit 0
30+
fi
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: audit-dependencies
2+
3+
on:
4+
# Sundays at 2am EST
5+
schedule:
6+
- cron: '0 7 * * 0'
7+
workflow_dispatch:
8+
inputs:
9+
audit-level:
10+
description: The level of audit to run (low, moderate, high, critical)
11+
required: false
12+
default: critical
13+
debug:
14+
description: Enable debug logging
15+
required: false
16+
default: false
17+
18+
env:
19+
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
20+
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
21+
22+
jobs:
23+
audit:
24+
runs-on: ubuntu-24.04
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Setup
29+
uses: ./.github/actions/setup
30+
31+
- name: Run audit dependencies script
32+
id: audit_dependencies
33+
run: ./.github/workflows/audit-dependencies.sh ${{ inputs.audit-level }}
34+
35+
- name: Slack notification on failure
36+
if: failure()
37+
uses: slackapi/slack-github-action@v2.1.0
38+
with:
39+
webhook: ${{ inputs.debug == 'true' && secrets.SLACK_TEST_WEBHOOK_URL || secrets.SLACK_WEBHOOK_URL }}
40+
webhook-type: incoming-webhook
41+
payload: |
42+
{
43+
"username": "GitHub Actions Bot",
44+
"blocks": [
45+
{
46+
"type": "section",
47+
"text": {
48+
"type": "mrkdwn",
49+
"text": "🚨 Actionable vulnerabilities found: <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>"
50+
}
51+
},
52+
]
53+
}

.github/workflows/main.yml

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
env:
20-
NODE_VERSION: 23.11.0
21-
PNPM_VERSION: 9.7.1
2220
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
2321
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
2422

@@ -71,10 +69,6 @@ jobs:
7169

7270
- name: Node setup
7371
uses: ./.github/actions/setup
74-
with:
75-
node-version: ${{ env.NODE_VERSION }}
76-
pnpm-version: ${{ env.PNPM_VERSION }}
77-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
7872

7973
- name: Lint
8074
run: pnpm lint -- --quiet
@@ -89,10 +83,6 @@ jobs:
8983

9084
- name: Node setup
9185
uses: ./.github/actions/setup
92-
with:
93-
node-version: ${{ env.NODE_VERSION }}
94-
pnpm-version: ${{ env.PNPM_VERSION }}
95-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
9686

9787
- run: pnpm run build:all
9888
env:
@@ -114,11 +104,8 @@ jobs:
114104
- name: Node setup
115105
uses: ./.github/actions/setup
116106
with:
117-
node-version: ${{ env.NODE_VERSION }}
118-
pnpm-version: ${{ env.PNPM_VERSION }}
119107
pnpm-run-install: false
120108
pnpm-restore-cache: false # Full build is restored below
121-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
122109

123110
- name: Restore build
124111
uses: actions/cache@v4
@@ -141,11 +128,8 @@ jobs:
141128
- name: Node setup
142129
uses: ./.github/actions/setup
143130
with:
144-
node-version: ${{ env.NODE_VERSION }}
145-
pnpm-version: ${{ env.PNPM_VERSION }}
146131
pnpm-run-install: false
147132
pnpm-restore-cache: false # Full build is restored below
148-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
149133

150134
- name: Restore build
151135
uses: actions/cache@v4
@@ -169,6 +153,7 @@ jobs:
169153
matrix:
170154
database:
171155
- mongodb
156+
- firestore
172157
- postgres
173158
- postgres-custom-schema
174159
- postgres-uuid
@@ -205,11 +190,8 @@ jobs:
205190
- name: Node setup
206191
uses: ./.github/actions/setup
207192
with:
208-
node-version: ${{ env.NODE_VERSION }}
209-
pnpm-version: ${{ env.PNPM_VERSION }}
210193
pnpm-run-install: false
211194
pnpm-restore-cache: false # Full build is restored below
212-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
213195

214196
- name: Restore build
215197
uses: actions/cache@v4
@@ -302,6 +284,7 @@ jobs:
302284
- fields__collections__Text
303285
- fields__collections__UI
304286
- fields__collections__Upload
287+
- folders
305288
- hooks
306289
- lexical__collections__Lexical__e2e__main
307290
- lexical__collections__Lexical__e2e__blocks
@@ -331,11 +314,8 @@ jobs:
331314
- name: Node setup
332315
uses: ./.github/actions/setup
333316
with:
334-
node-version: ${{ env.NODE_VERSION }}
335-
pnpm-version: ${{ env.PNPM_VERSION }}
336317
pnpm-run-install: false
337318
pnpm-restore-cache: false # Full build is restored below
338-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
339319

340320
- name: Restore build
341321
uses: actions/cache@v4
@@ -440,6 +420,7 @@ jobs:
440420
- fields__collections__Text
441421
- fields__collections__UI
442422
- fields__collections__Upload
423+
- folders
443424
- hooks
444425
- lexical__collections__Lexical__e2e__main
445426
- lexical__collections__Lexical__e2e__blocks
@@ -469,11 +450,8 @@ jobs:
469450
- name: Node setup
470451
uses: ./.github/actions/setup
471452
with:
472-
node-version: ${{ env.NODE_VERSION }}
473-
pnpm-version: ${{ env.PNPM_VERSION }}
474453
pnpm-run-install: false
475454
pnpm-restore-cache: false # Full build is restored below
476-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
477455

478456
- name: Restore build
479457
uses: actions/cache@v4
@@ -575,11 +553,8 @@ jobs:
575553
- name: Node setup
576554
uses: ./.github/actions/setup
577555
with:
578-
node-version: ${{ env.NODE_VERSION }}
579-
pnpm-version: ${{ env.PNPM_VERSION }}
580556
pnpm-run-install: false
581557
pnpm-restore-cache: false # Full build is restored below
582-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
583558

584559
- name: Restore build
585560
uses: actions/cache@v4
@@ -675,11 +650,8 @@ jobs:
675650
- name: Node setup
676651
uses: ./.github/actions/setup
677652
with:
678-
node-version: ${{ env.NODE_VERSION }}
679-
pnpm-version: ${{ env.PNPM_VERSION }}
680653
pnpm-run-install: false
681654
pnpm-restore-cache: false # Full build is restored below
682-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
683655

684656
- name: Restore build
685657
uses: actions/cache@v4
@@ -737,11 +709,8 @@ jobs:
737709
- name: Node setup
738710
uses: ./.github/actions/setup
739711
with:
740-
node-version: ${{ env.NODE_VERSION }}
741-
pnpm-version: ${{ env.PNPM_VERSION }}
742712
pnpm-run-install: false
743713
pnpm-restore-cache: false # Full build is restored below
744-
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
745714

746715
- name: Restore build
747716
uses: actions/cache@v4
@@ -754,6 +723,8 @@ jobs:
754723
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
755724

756725
- name: Analyze esbuild bundle size
726+
# Temporarily disable this for community PRs until this can be implemented in a separate workflow
727+
if: github.event.pull_request.head.repo.fork == false
757728
uses: exoego/esbuild-bundle-analyzer@v1
758729
with:
759730
metafiles: 'packages/payload/meta_index.json,packages/payload/meta_shared.json,packages/ui/meta_client.json,packages/ui/meta_shared.json,packages/next/meta_index.json,packages/richtext-lexical/meta_client.json'

.github/workflows/post-release-templates.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
workflow_dispatch:
88

99
env:
10-
NODE_VERSION: 23.11.0
11-
PNPM_VERSION: 9.7.1
1210
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
1311
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
1412

@@ -60,9 +58,6 @@ jobs:
6058

6159
- name: Setup
6260
uses: ./.github/actions/setup
63-
with:
64-
node-version: ${{ env.NODE_VERSION }}
65-
pnpm-version: ${{ env.PNPM_VERSION }}
6661

6762
- name: Start PostgreSQL
6863
uses: CasperWA/postgresql-action@v1.2
@@ -87,6 +82,11 @@ jobs:
8782
with:
8883
mongodb-version: 6.0
8984

85+
# The template generation script runs import map generation which needs the built payload bin scripts
86+
- run: pnpm run build:all
87+
env:
88+
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
89+
9090
- name: Update template lockfiles and migrations
9191
run: pnpm script:gen-templates
9292

.github/workflows/post-release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ on:
1212
default: ''
1313

1414
env:
15-
NODE_VERSION: 23.11.0
16-
PNPM_VERSION: 9.7.1
1715
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
1816
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
1917

0 commit comments

Comments
 (0)