Skip to content

Commit 3484fd7

Browse files
committed
Re-add the reusable file.
1 parent 4a117c5 commit 3484fd7

3 files changed

Lines changed: 110 additions & 96 deletions

File tree

.github/workflows/check-built-files.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ permissions: {}
4444

4545
jobs:
4646
check-for-built-file-changes:
47-
name: Check built files
47+
name: Check built files for uncommitted changes
4848
if: ${{ github.repository == 'wordpress/wordpress-develop' }}
4949
uses: ./.github/workflows/reusable-check-built-files.yml
5050
permissions:
5151
contents: read
5252

5353
# Compares the results of the build script with WordPress/WordPress.
5454
compare-build-script-results:
55-
name: Compare built files
55+
name: Compare built files to WordPress/WordPress
5656
uses: reusable-compare-built-files-v1.yml
5757
permissions:
5858
contents: read

.github/workflows/reusable-check-built-files.yml

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
# A reusable workflow that checks for uncommitted changes to built files in pull requests.
33
##
4-
name: Check Built Files (PRs)
4+
name: Check for Uncommitted Changes (PRs)
55

66
on:
77
workflow_call:
@@ -108,96 +108,3 @@ jobs:
108108
with:
109109
name: pr-built-file-changes
110110
path: changes.diff
111-
112-
# Compares the results of npm run build with WordPress/WordPress
113-
#
114-
# Performs the following steps:
115-
# - Checks out the repository.
116-
# - Sets up Node.js.
117-
# - Logs debug information about the GitHub Action runner.
118-
# - Installs npm dependencies.
119-
# - Builds WordPress to run from the build directory.
120-
# - Ensures version-controlled files are not modified or deleted.
121-
# - Checks out the WordPress/WordPress repository.
122-
# - Creates a directory for text files to be uploaded as an artifact.
123-
# - Storse a list of files that differ in the build directory from WordPress/WordPress.
124-
# - Storse a diff file comparing the build directory to WordPress/WordPress.
125-
# - Saves the pull request number to a text file.
126-
# - Uploads the generated files as an artifact.
127-
compare-built-files:
128-
name: Detect differences between WordPress/WordPress
129-
runs-on: ubuntu-24.04
130-
permissions:
131-
contents: read
132-
timeout-minutes: 10
133-
134-
steps:
135-
- name: Checkout repository
136-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
137-
with:
138-
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
139-
persist-credentials: false
140-
141-
- name: Set up Node.js
142-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
143-
with:
144-
node-version-file: '.nvmrc'
145-
cache: npm
146-
147-
- name: Set up PHP
148-
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
149-
with:
150-
php-version: '8.4'
151-
coverage: none
152-
153-
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
154-
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
155-
- name: Install Composer dependencies
156-
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
157-
with:
158-
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
159-
160-
- name: Log debug information
161-
run: |
162-
npm --version
163-
node --version
164-
git --version
165-
166-
- name: Install npm Dependencies
167-
run: npm ci
168-
169-
- name: Build WordPress to run from build directory
170-
run: npm run build
171-
172-
- name: Ensure version-controlled files are not modified or deleted
173-
run: git diff --exit-code
174-
175-
- name: Checkout WordPress/WordPress
176-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
177-
with:
178-
repository: 'WordPress/WordPress'
179-
path: ${{ github.workspace }}/built-wordpress
180-
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
181-
persist-credentials: false
182-
183-
- name: Create directory for artifacts
184-
run: mkdir artifacts
185-
186-
- name: Create a list of files that have changed
187-
run: diff -rq ${{ github.workspace }}/build ${{ github.workspace }}/built-wordpress | sed "s|${{ github.workspace }}/||g" > artifacts/file-changes.txt
188-
189-
- name: Create a list of files that have changed
190-
run: diff -r ${{ github.workspace }}/build ${{ github.workspace }}/built-wordpress | sed "s|${{ github.workspace }}/||g" > artifacts/changes.diff
191-
192-
- name: Save PR number
193-
run: echo "${EVENT_NUMBER}" > ./artifacts/NR
194-
env:
195-
EVENT_NUMBER: ${{ github.event.number }}
196-
197-
# Uploads the associated text files as an artifact.
198-
- name: Upload comparison results as an artifact
199-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
200-
#if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }}
201-
with:
202-
name: build-script-comparison
203-
path: artifacts/
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
##
2+
# A reusable workflow that compares the results of the build script with the most recent build server commit.
3+
##
4+
name: Reusable Compare Built Files
5+
6+
on:
7+
workflow_call:
8+
9+
# Disable permissions for all available scopes by default.
10+
# Any needed permissions should be configured at the job level.
11+
permissions: {}
12+
13+
jobs:
14+
# Runs the PHP coding standards checks.
15+
#
16+
# Violations are reported inline with annotations.
17+
#
18+
# Performs the following steps:
19+
# - Checks out the repository.
20+
# - Sets up Node.js.
21+
# - Logs debug information about the GitHub Action runner.
22+
# - Installs npm dependencies.
23+
# - Builds WordPress to run from the build directory.
24+
# - Ensures version-controlled files are not modified or deleted.
25+
# - Checks out the WordPress/WordPress repository.
26+
# - Creates a directory for text files to be uploaded as an artifact.
27+
# - Storse a list of files that differ in the build directory from WordPress/WordPress.
28+
# - Storse a diff file comparing the build directory to WordPress/WordPress.
29+
# - Saves the pull request number to a text file.
30+
# - Uploads the generated files as an artifact.
31+
compare-built-files:
32+
name: Compare built files to WordPress/WordPress
33+
runs-on: ubuntu-24.04
34+
permissions:
35+
contents: read
36+
timeout-minutes: 10
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
41+
with:
42+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
43+
persist-credentials: false
44+
45+
- name: Set up Node.js
46+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
47+
with:
48+
node-version-file: '.nvmrc'
49+
cache: npm
50+
51+
- name: Set up PHP
52+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
53+
with:
54+
php-version: '8.4'
55+
coverage: none
56+
57+
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
58+
# passing a custom cache suffix ensures that the cache is flushed at least once per week.
59+
- name: Install Composer dependencies
60+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
61+
with:
62+
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
63+
64+
- name: Log debug information
65+
run: |
66+
npm --version
67+
node --version
68+
git --version
69+
70+
- name: Install npm Dependencies
71+
run: npm ci
72+
73+
- name: Build WordPress to run from build directory
74+
run: npm run build
75+
76+
- name: Ensure version-controlled files are not modified or deleted
77+
run: git diff --exit-code
78+
79+
- name: Checkout WordPress/WordPress
80+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
81+
with:
82+
repository: 'WordPress/WordPress'
83+
path: ${{ github.workspace }}/built-wordpress
84+
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
85+
persist-credentials: false
86+
87+
- name: Create directory for artifacts
88+
run: mkdir artifacts
89+
90+
- name: Create a list of files that have changed
91+
run: diff -rq ${{ github.workspace }}/build ${{ github.workspace }}/built-wordpress | sed "s|${{ github.workspace }}/||g" > artifacts/file-changes.txt
92+
93+
- name: Create a list of files that have changed
94+
run: diff -r ${{ github.workspace }}/build ${{ github.workspace }}/built-wordpress | sed "s|${{ github.workspace }}/||g" > artifacts/changes.diff
95+
96+
- name: Save PR number
97+
run: echo "${EVENT_NUMBER}" > ./artifacts/NR
98+
env:
99+
EVENT_NUMBER: ${{ github.event.number }}
100+
101+
# Uploads the associated text files as an artifact.
102+
- name: Upload comparison results as an artifact
103+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
104+
#if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }}
105+
with:
106+
name: build-script-comparison
107+
path: artifacts/

0 commit comments

Comments
 (0)