Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/commit-built-file-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
workflow_run:
workflows:
- 'Check Built Files (PRs)'
- 'Sync Gutenberg Packages'
- 'Test Default Themes & Create ZIPs'
types:
- completed
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/sync-gutenberg-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Sync Gutenberg Packages

on:
pull_request:
types:
- 'labeled'
workflow_dispatch:
# Gutenberg plugin releases happens every Tuesday.
# Running on Monday ensures only the previous week's release is detected.
schedule:
- cron: '0 0 * * 1'

jobs:

update-packages:
name: Sync block editor-related package updates
runs-on: 'ubuntu-24.04'
if: |
(
github.repository != 'WordPress/wordpress-develop' &&
github.event_name == 'workflow_dispatch'
) ||
github.repository == 'WordPress/wordpress-develop' &&
(
github.event.action != 'labeled' ||
'sync-gutenberg' == github.event.label.name
)
permissions:
contents: write
pull-requests: write
timeout-minutes: 30

steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.ref || github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.ref }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: true

- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: '.nvmrc'
cache: npm

- name: Log debug information
run: |
npm --version
node --version
curl --version
git --version

- name: Install npm Dependencies
run: npm ci

- name: Sync packages
run: npm run sync-gutenberg-packages

- name: Run post-sync script
run: npm run postsync-gutenberg-packages

- name: Check for changes to versioned files
id: built-file-check
run: |
if git diff --quiet; then
echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT"
else
echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT"
fi

- name: Display changes to versioned files
if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
run: git diff

- name: Save diff to a file
if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
run: git diff > ./changes.diff

# Uploads the diff file as an artifact.
- name: Upload diff file as artifact
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
with:
name: pr-built-file-changes
path: changes.diff

- name: Remove the sync-gutenberg label
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
if: ${{ github.event.action == 'labeled' && 'sync-gutenberg' == github.event.label.name }}
with:
retries: 2
retry-exempt-status-codes: 418
script: |
github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: process.env.ISSUE_NUMBER,
name: 'sync-gutenberg'
});
env:
ISSUE_NUMBER: ${{ github.event.number }}
Loading