Skip to content

Commit 71edc72

Browse files
committed
Build/Test Tools: Commit changes to built theme files for PRs.
When there are uncommitted changes to versioned files in default themes, the theme testing workflow will now store the patch file required for the changes to be committed back to the pull request. See #63170, #63171. git-svn-id: https://develop.svn.wordpress.org/trunk@60348 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0c56e64 commit 71edc72

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/workflows/commit-built-file-changes.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Commit Built File Changes (PRs)
33

44
on:
55
workflow_run:
6-
workflows: [ 'Check Built Files (PRs)' ]
6+
workflows:
7+
- 'Check Built Files (PRs)'
8+
- 'Test Default Themes & Create ZIPs'
79
types:
810
- completed
911

.github/workflows/test-and-zip-default-themes.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,32 @@ jobs:
148148
- name: Build theme
149149
run: npm run build
150150

151+
- name: Check for changes to versioned files
152+
id: built-file-check
153+
if: ${{ github.event_name == 'pull_request' }}
154+
run: |
155+
if git diff --quiet; then
156+
echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT"
157+
else
158+
echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT"
159+
fi
160+
161+
- name: Display changes to versioned files
162+
if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
163+
run: git diff
164+
165+
- name: Save diff to a file
166+
if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
167+
run: git diff > ./changes.diff
168+
169+
# Uploads the diff file as an artifact.
170+
- name: Upload diff file as artifact
171+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
172+
if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
173+
with:
174+
name: pr-built-file-changes
175+
path: src/wp-content/themes/${{ matrix.theme }}/changes.diff
176+
151177
- name: Ensure version-controlled files are not modified or deleted
152178
run: git diff --exit-code
153179

0 commit comments

Comments
 (0)