Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
f3c9da1
Add a workflow for checking and managing built files.
desrosj Feb 5, 2025
f95ca4a
Re-add dependabot for npm.
desrosj Feb 5, 2025
b524992
Merge remote-tracking branch 'upstream/trunk' into trunk
desrosj Mar 4, 2025
84c1f50
Merge remote-tracking branch 'upstream/trunk' into trunk
desrosj Mar 4, 2025
5bbcb9c
Merge remote-tracking branch 'upstream/trunk' into trunk
desrosj Mar 10, 2025
138bc04
Remove dependabot file to reset PRs.
desrosj Mar 10, 2025
f18472d
Re-adding core's current dependabot file to test.
desrosj Mar 10, 2025
bdba21a
Re-add full new config.
desrosj Mar 10, 2025
dca21dd
Limit to just playwright for now for testing purposes.
desrosj Mar 10, 2025
dc487cf
Exclude all for now.
desrosj Mar 10, 2025
8a69785
Lint fixes.
desrosj Mar 10, 2025
feb0a23
Try again
desrosj Mar 10, 2025
c315b49
Another test.
desrosj Mar 11, 2025
3ba25cf
Linting fix.
desrosj Mar 11, 2025
4aa86c2
Lint fix.
desrosj Mar 11, 2025
c3f00b8
Lint fix.
desrosj Mar 11, 2025
99b33f9
Merge remote-tracking branch 'upstream/trunk' into trunk
desrosj Mar 11, 2025
0d32c60
Test adding constraint.
desrosj Mar 11, 2025
77a443c
Revert linting fixes.
desrosj Mar 11, 2025
7bda7d7
Copy lint fixes.
desrosj Mar 11, 2025
09041b7
Re-add original dependabot config.
desrosj Mar 11, 2025
8d22bce
Merge remote-tracking branch 'upstream/trunk' into trunk
desrosj Mar 13, 2025
966fd42
Use different approach for diff checking.
desrosj Mar 13, 2025
f704669
Use output not env.
desrosj Mar 13, 2025
1b6a098
Add visual diff.
desrosj Mar 13, 2025
51e7668
Downgrade some packages.
desrosj Mar 13, 2025
e0cbc00
Make use of reusable pattern.
desrosj Mar 13, 2025
d12337c
Fix permissions.
desrosj Mar 13, 2025
277e421
Pass secrets correctly.
desrosj Mar 13, 2025
96c4b15
Package change.
desrosj Mar 13, 2025
c2278e8
Test changing workflow file.
desrosj Mar 13, 2025
50676f5
Sync lock file.
desrosj Mar 13, 2025
453e342
Change built files.
desrosj Mar 13, 2025
56a46b1
Retrigger.
desrosj Mar 13, 2025
fa1fdb7
Why?
desrosj Mar 13, 2025
03f680d
Switch back
desrosj Mar 13, 2025
95770a4
Remove push
desrosj Mar 13, 2025
c266365
Try shorter token expiration
desrosj Mar 13, 2025
ef1455f
Downgrade.
desrosj Mar 14, 2025
76f788e
Permission tweaks.
desrosj Mar 14, 2025
e715db6
Correct typo.
desrosj Mar 14, 2025
0f5311d
Revert reusable change.
desrosj Mar 14, 2025
6fb411b
Revert "Revert reusable change."
desrosj Mar 14, 2025
ebe6e1e
Automation: Updating built files with changes. [dependabot skip]
dependabot[bot] Mar 14, 2025
781cc39
Revert "Automation: Updating built files with changes. [dependabot sk…
desrosj Mar 14, 2025
0b91b5b
Remove PR write.
desrosj Mar 14, 2025
69fa15c
Testing change.
desrosj Mar 14, 2025
7b5eaa8
Revert "Testing change."
desrosj Mar 14, 2025
c55f3cc
Readd trunk push to test.
desrosj Mar 14, 2025
ce1e107
Automation: Updating built files with changes. [dependabot skip]
dependabot[bot] Mar 14, 2025
5c1fda5
Reference version of workflow in `trunk`.
desrosj Mar 14, 2025
0af0b96
Remove PR permission.
desrosj Mar 14, 2025
6ea31cf
Merge branch 'trunk' of github.com:desrosj/wordpress-develop into trunk
desrosj Mar 14, 2025
02b87d0
Testing something.
desrosj Mar 14, 2025
7502541
Try again.
desrosj Mar 14, 2025
b9a61a5
Automation: Updating built files with changes. [dependabot skip]
dependabot[bot] Mar 14, 2025
98b5f3f
Revert tests.
desrosj Mar 14, 2025
29735fd
Change local reference.
desrosj Mar 14, 2025
0e84755
Merge branch 'trunk' of github.com:desrosj/wordpress-develop into trunk
desrosj Mar 14, 2025
b551ece
Undo change.
desrosj Mar 14, 2025
fe31794
Merge remote-tracking branch 'upstream/trunk' into trunk
desrosj Mar 17, 2025
865ea05
Fix merge conflict.
desrosj Mar 17, 2025
19571dd
Try fully formed `ref`.
desrosj Mar 17, 2025
ac452be
Try supplying repository.
desrosj Mar 17, 2025
4d63450
Try switching user name for Git.
desrosj Mar 19, 2025
086d4e6
Try different name for matching.
desrosj Mar 19, 2025
3022145
Use slug for app.
desrosj Mar 19, 2025
1af6cde
Bad copy/paste.
desrosj Mar 19, 2025
0a45ef1
Try this.
desrosj Mar 19, 2025
e4b87c2
Adjust action.
desrosj Mar 20, 2025
4e7b1b3
Change back.
desrosj Mar 20, 2025
5599da7
Add PR permissions
desrosj Mar 20, 2025
33f461f
Some test changes.
desrosj Mar 21, 2025
47ec938
Change repo check.
desrosj Mar 21, 2025
0462755
Add third workflow.
desrosj Mar 21, 2025
8274c0f
Use correct repository name.
desrosj Mar 21, 2025
2118ee2
Add token generation.
desrosj Mar 21, 2025
d14263e
Check for zip file before proceeding.
desrosj Mar 21, 2025
22ae1d4
Don't fail workflow when no artifact is found.
desrosj Mar 21, 2025
c707d6d
Change directory check.
desrosj Mar 21, 2025
3040542
Fix workflow_run reference.
desrosj Mar 21, 2025
1eddacd
Change some paths.
desrosj Mar 21, 2025
cc13b15
Adjustment
desrosj Mar 21, 2025
92a65c6
Adjustments
desrosj Mar 21, 2025
c6516eb
Condition was flipped
desrosj Mar 21, 2025
6a001fb
Fix patch command.
desrosj Mar 21, 2025
513ca36
Adjustments.
desrosj Mar 21, 2025
606fa29
Correct artifact path.
desrosj Mar 21, 2025
c9b466c
More tweaks to avoid overwriting artifact by checkout.
desrosj Mar 21, 2025
8dabbcb
Another approach.
desrosj Mar 21, 2025
dd8d3c4
Doc changes. Try without custom token.
desrosj Mar 21, 2025
9b98ebf
Correct workflow name
desrosj Mar 21, 2025
635832e
Eliminate the need for a token at all.
desrosj Mar 21, 2025
16e2fdc
Cleanup.
desrosj Mar 21, 2025
02ea91a
Use PR head details.
desrosj Mar 21, 2025
15c272e
Automation: Updating built files with changes. [dependabot skip]
Mar 21, 2025
4927a82
Debug
desrosj Mar 21, 2025
2bccc88
Merge branch 'trunk' of github.com:desrosj/wordpress-develop into trunk
desrosj Mar 21, 2025
d6b1516
Fix contexts.
desrosj Mar 21, 2025
690d866
Built file change.
desrosj Mar 21, 2025
7bf88b7
Re-add token.
desrosj Mar 21, 2025
916a08c
Use access token for checkout.
desrosj Mar 21, 2025
3c7c94d
Bump the dev-css-sass group across 1 directory with 3 updates
dependabot[bot] Mar 21, 2025
4ea30c5
Automation: Updating built files with changes. [dependabot skip]
Mar 21, 2025
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
98 changes: 98 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,101 @@ updates:
composer-packages:
patterns:
- "composer/ca-bundle"

# Monitor some npm dependencies for updates in groups.
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 50
ignore:
- dependency-name: "@wordpress/*"
groups:
##
# Groups for updating devDependencies.
##

# Dependencies related to Playwright testing (E2E, performance).
tests-playwright:
patterns:
- "*playwright*"
# Dependencies related to JavaScript testing with QUnit.
tests-qunit:
patterns:
- "*qunit*"
- "sinon*"
# Dependencies related to CSS and SASS building and manilupating.
dev-css-sass:
patterns:
- "autoprefixer"
# postcss and css related dependencies.
- "*css*"
- "*sass"
# Dependencies related to the Webpack build process.
dev-webpack:
patterns:
- "*webpack*"
- "react-refresh"
- "source-map-loader"
# Dependencies related to the local Docker development environment.
dev-docker:
patterns:
- "dotenv*"
- "wait-on"
# Dependencies that do not fall into a specific grouping.
dev-miscellaneous:
patterns:
- "chalk"
- "check-node-version"
- "ink-docstrap"
- "install-changed"
- "matchdep"
- "uuid"
# Dependencies related to JavaScript minification.
dev-uglify:
patterns:
- "*uglify*"
# All GruntJS related dependencies that do not relate to another group.
dev-grunt:
patterns:
- "*grunt*"

##
# Groups for updating production dependencies.
##

# Dependencies related to jQuery and its ecosystem.
external-jquery:
patterns:
- "jquery*"
# Dependencies related to React and its ecosystem.
external-react:
patterns:
- "react*"
- "!react-refresh"
# Dependencies used for bundling polyfill libraries into WordPress.
external-polyfills:
patterns:
- "core-js-url-browser"
- "element-closest"
- "formdata-polyfill"
- "imagesloaded"
- "objectFitPolyfill"
- "polyfill-library"
- "regenerator-runtime"
- "whatwg-fetch"
- "wicg-inert"
# Dependencies related to the Masonry library.
external-masonry:
patterns:
- "masonry-layout"
# Dependencies that do not fall into a specific grouping.
external-miscellaneous:
patterns:
- "backbone"
- "clipboard"
- "hoverintent"
- "json2php"
- "lodash"
- "moment"
- "underscore"
25 changes: 10 additions & 15 deletions .github/workflows/check-built-files.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Checks for uncommitted changes to built files and pushes changes back.
name: Check built files
# Checks for uncommitted changes to built files in pull requests.
name: Check Built Files (PRs)

on:
# Because all commits happen through SVN and should always be manually reviewed by a committer, this workflow only
# runs for pull requests.
#
# Other workflows that run on push will detect changes to versioned files and fail.
pull_request_target:
# Other workflows that run for the push event will detect changes to versioned files and fail.
pull_request:
branches:
- trunk
- '6.[8-9]'
Expand All @@ -31,21 +31,16 @@ on:
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.sha }}
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}

jobs:
update-built-files:
name: Update built files
permissions:
contents: write
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
# This should always reference a version of the workflow committed through SVN and never a local reference.
uses: WordPress/wordpress-develop/.github/workflows/reusable-check-built-files.yml@trunk
secrets:
GH_APP_ID: ${{ secrets.GH_PR_MANAGEMENT_APP_ID }}
GH_APP_PRIVATE_KEY: ${{ secrets.GH_PR_MANAGEMENT_APP_PRIVATE_KEY }}
check-for-built-file-changes:
name: Check built files
# This prevents an unnecessary second run after changes are committed back because Dependabot always rebases and force pushes.
if: ${{ github.repository == 'desrosj/wordpress-develop' && ( github.actor != 'dependabot[bot]' || github.event.commits < 2 ) }}
uses: ./.github/workflows/reusable-check-built-files.yml
164 changes: 164 additions & 0 deletions .github/workflows/commit-built-file-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Commits all missed changes to built files back to pull request branches.
name: Commit Built File Changes (PRs)

on:
workflow_run:
workflows: [ 'Check Built Files (PRs)' ]
types:
- completed

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_run' && format( '{0}-{1}', github.event.workflow_run.head_branch, github.event.workflow_run.head_repository.name ) || github.sha }}

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}

jobs:
# Checks a PR for uncommitted changes to built files.
#
# Performs the following steps:
# - Attempts to download the artifact containing the PR diff.
# - Checks for the existence of an artifact.
# - Unzips the artifact.
# - Generates a token for authenticating with the GitHub App.
# - Checks out the repository.
# - Applies the patch file.
# - Displays the result of git diff.
# - Configures the Git author.
# - Stages changes.
# - Commits changes.
# - Pushes changes.
update-built-files:
name: Check and update built files
runs-on: ubuntu-24.04
if: ${{ github.repository == 'desrosj/wordpress-develop' }}
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts( {
owner: context.repo.owner,
repo: context.repo.repo,
run_id: process.env.RUN_ID,
} );

const matchArtifact = artifacts.data.artifacts.filter( ( artifact ) => {
return artifact.name === 'pr-built-file-changes'
} )[0];

if ( ! matchArtifact ) {
core.info( 'No artifact found!' );
return;
}

const download = await github.rest.actions.downloadArtifact( {
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
} );

const fs = require( 'fs' );
fs.writeFileSync( '${{ github.workspace }}/pr-built-file-changes.zip', Buffer.from( download.data ) )
env:
RUN_ID: ${{ github.event.workflow_run.id }}

- name: Check for artifact
id: artifact-check
run: |
if [ -f "pr-built-file-changes.zip" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Unzip the artifact containing the PR data
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
run: unzip pr-built-file-changes.zip

- name: Generate Installation Token
id: generate_token
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
env:
GH_APP_ID: ${{ secrets.GH_APP_ID }}
GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }}
run: |
echo "$GH_APP_PRIVATE_KEY" > private-key.pem

# Generate JWT
JWT=$(python3 - <<EOF
import jwt, time
private_key = open("private-key.pem", "r").read()
payload = {
"iat": int(time.time()),
"exp": int(time.time()) + 600, # 10-minute expiration
"iss": $GH_APP_ID
}
print(jwt.encode(payload, private_key, algorithm="RS256"))
EOF
)

# Get Installation ID
INSTALLATION_ID=$(curl -s -X GET -H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/app/installations | jq -r '.[0].id')

# Request Installation Access Token
ACCESS_TOKEN=$(curl -s -X POST -H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/app/installations/$INSTALLATION_ID/access_tokens" | jq -r '.token')

echo "ACCESS_TOKEN=$ACCESS_TOKEN" >> "$GITHUB_ENV"

rm -f private-key.pem

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
path: 'pr-repo'
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
token: ${{ env.ACCESS_TOKEN }}

- name: Apply patch
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
working-directory: 'pr-repo'
run: git apply ${{ github.workspace }}/changes.diff

- name: Display changes to versioned files
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
working-directory: 'pr-repo'
run: git diff

- name: Configure git user name and email
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
working-directory: 'pr-repo'
run: |
git config user.name "WordPress Build Script Bot[bot]"
git config user.email wordpress@users.noreply.github.com

- name: Stage changes
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
working-directory: 'pr-repo'
run: git add .

- name: Commit changes
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
working-directory: 'pr-repo'
run: |
git commit -m "Automation: Updating built files with changes. [dependabot skip]"

- name: Push changes
if: ${{ steps.artifact-check.outputs.exists == 'true' }}
working-directory: 'pr-repo'
run: git push
Loading
Loading