Skip to content

Commit 53b739b

Browse files
committed
Build/Test Tools: Skip pull_request triggered runs in private repos.
This modifies the conditions for GitHub Actions workflow runs so that they do not run within private forks and mirrors for `pull_request` events when the PR is in `draft` status. For situations where this may be desirable, a `Draft Workflow Runs` label can be added to a `draft` pull request to force workflows to run. Props desrosj, jorbin. See #65848. git-svn-id: https://develop.svn.wordpress.org/trunk@63183 602fd350-edb4-49c9-b593-d223f7449a82
1 parent bc4c26a commit 53b739b

11 files changed

Lines changed: 156 additions & 18 deletions

‎.github/workflows/coding-standards.yml‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,29 @@ jobs:
5050
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
5151
permissions:
5252
contents: read
53-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
53+
if: |
54+
github.repository == 'WordPress/wordpress-develop' || (
55+
github.event_name == 'pull_request' && (
56+
! github.event.repository.private ||
57+
! github.event.pull_request.draft ||
58+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
59+
)
60+
)
5461
5562
# Runs the JavaScript coding standards checks.
5663
jshint:
5764
name: Coding standards
5865
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
5966
permissions:
6067
contents: read
61-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
68+
if: |
69+
github.repository == 'WordPress/wordpress-develop' || (
70+
github.event_name == 'pull_request' && (
71+
! github.event.repository.private ||
72+
! github.event.pull_request.draft ||
73+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
74+
)
75+
)
6276
6377
slack-notifications:
6478
name: Slack Notifications

‎.github/workflows/end-to-end-tests.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ jobs:
5757
uses: WordPress/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@trunk
5858
permissions:
5959
contents: read
60-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
60+
if: |
61+
github.repository == 'WordPress/wordpress-develop' || (
62+
github.event_name == 'pull_request' && (
63+
! github.event.repository.private ||
64+
! github.event.pull_request.draft ||
65+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
66+
)
67+
)
6168
strategy:
6269
fail-fast: false
6370
matrix:

‎.github/workflows/javascript-tests.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ jobs:
5353
uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
5454
permissions:
5555
contents: read
56-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
56+
if: |
57+
github.repository == 'WordPress/wordpress-develop' || (
58+
github.event_name == 'pull_request' && (
59+
! github.event.repository.private ||
60+
! github.event.pull_request.draft ||
61+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
62+
)
63+
)
5764
5865
slack-notifications:
5966
name: Slack Notifications

‎.github/workflows/javascript-type-checking.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ jobs:
4646
uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-type-checking-v1.yml@trunk
4747
permissions:
4848
contents: read
49-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
49+
if: |
50+
github.repository == 'WordPress/wordpress-develop' || (
51+
github.event_name == 'pull_request' && (
52+
! github.event.repository.private ||
53+
! github.event.pull_request.draft ||
54+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
55+
)
56+
)
5057
5158
slack-notifications:
5259
name: Slack Notifications

‎.github/workflows/performance.yml‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ jobs:
5050
determine-matrix:
5151
name: Determine Matrix
5252
runs-on: ubuntu-24.04
53-
if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }}
53+
if: |
54+
(
55+
github.repository == 'WordPress/wordpress-develop' || (
56+
github.event_name == 'pull_request' && (
57+
! github.event.repository.private ||
58+
! github.event.pull_request.draft ||
59+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
60+
)
61+
)
62+
) &&
63+
! contains( github.event.before, '00000000' )
5464
permissions:
5565
actions: read
5666
env:

‎.github/workflows/php-compatibility.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ jobs:
4242
uses: WordPress/wordpress-develop/.github/workflows/reusable-php-compatibility.yml@trunk
4343
permissions:
4444
contents: read
45-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
45+
if: |
46+
github.repository == 'WordPress/wordpress-develop' || (
47+
github.event_name == 'pull_request' && (
48+
! github.event.repository.private ||
49+
! github.event.pull_request.draft ||
50+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
51+
)
52+
)
4653
4754
slack-notifications:
4855
name: Slack Notifications

‎.github/workflows/phpstan-static-analysis.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ jobs:
4242
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpstan-static-analysis-v1.yml@trunk
4343
permissions:
4444
contents: read
45-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
45+
if: |
46+
github.repository == 'WordPress/wordpress-develop' || (
47+
github.event_name == 'pull_request' && (
48+
! github.event.repository.private ||
49+
! github.event.pull_request.draft ||
50+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
51+
)
52+
)
4653
4754
slack-notifications:
4855
name: Slack Notifications

‎.github/workflows/phpunit-tests.yml‎

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ jobs:
5858
uses: WordPress/wordpress-develop/.github/workflows/reusable-prepare-gutenberg.yml@trunk
5959
permissions:
6060
contents: read
61-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
61+
if: |
62+
github.repository == 'WordPress/wordpress-develop' || (
63+
github.event_name == 'pull_request' && (
64+
! github.event.repository.private ||
65+
! github.event.pull_request.draft ||
66+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
67+
)
68+
)
6269
6370
#
6471
# Creates a PHPUnit test job for each PHP/MySQL combination.
@@ -76,7 +83,16 @@ jobs:
7683
secrets:
7784
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7885
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
79-
if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
86+
if: |
87+
startsWith( github.repository, 'WordPress/' ) && (
88+
github.repository == 'WordPress/wordpress-develop' || (
89+
github.event_name == 'pull_request' && (
90+
! github.event.repository.private ||
91+
! github.event.pull_request.draft ||
92+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
93+
)
94+
)
95+
)
8096
strategy:
8197
fail-fast: false
8298
matrix:
@@ -159,7 +175,16 @@ jobs:
159175
secrets:
160176
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
161177
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
162-
if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
178+
if: |
179+
startsWith( github.repository, 'WordPress/' ) && (
180+
github.repository == 'WordPress/wordpress-develop' || (
181+
github.event_name == 'pull_request' && (
182+
! github.event.repository.private ||
183+
! github.event.pull_request.draft ||
184+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
185+
)
186+
)
187+
)
163188
strategy:
164189
fail-fast: false
165190
matrix:
@@ -217,7 +242,16 @@ jobs:
217242
secrets:
218243
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
219244
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
220-
if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
245+
if: |
246+
startsWith( github.repository, 'WordPress/' ) && (
247+
github.repository == 'WordPress/wordpress-develop' || (
248+
github.event_name == 'pull_request' && (
249+
! github.event.repository.private ||
250+
! github.event.pull_request.draft ||
251+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
252+
)
253+
)
254+
)
221255
strategy:
222256
fail-fast: false
223257
matrix:
@@ -264,7 +298,16 @@ jobs:
264298
secrets:
265299
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
266300
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
267-
if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
301+
if: |
302+
startsWith( github.repository, 'WordPress/' ) && (
303+
github.repository == 'WordPress/wordpress-develop' || (
304+
github.event_name == 'pull_request' && (
305+
! github.event.repository.private ||
306+
! github.event.pull_request.draft ||
307+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
308+
)
309+
)
310+
)
268311
strategy:
269312
fail-fast: false
270313
matrix:
@@ -298,7 +341,13 @@ jobs:
298341
secrets:
299342
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
300343
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
301-
if: ${{ ! startsWith( github.repository, 'WordPress/' ) && github.event_name == 'pull_request' }}
344+
if: |
345+
! startsWith( github.repository, 'WordPress/' ) &&
346+
github.event_name == 'pull_request' && (
347+
! github.event.repository.private ||
348+
! github.event.pull_request.draft ||
349+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
350+
)
302351
strategy:
303352
fail-fast: false
304353
matrix:

‎.github/workflows/test-build-processes.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ jobs:
5151
uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
5252
permissions:
5353
contents: read
54-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
54+
if: |
55+
github.repository == 'WordPress/wordpress-develop' || (
56+
github.event_name == 'pull_request' && (
57+
! github.event.repository.private ||
58+
! github.event.pull_request.draft ||
59+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
60+
)
61+
)
5562
strategy:
5663
fail-fast: false
5764
matrix:

‎.github/workflows/upgrade-develop-testing.yml‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ jobs:
4444
build:
4545
name: Build
4646
uses: WordPress/wordpress-develop/.github/workflows/reusable-build-package.yml@trunk
47-
if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
47+
if: |
48+
startsWith( github.repository, 'WordPress/' ) && (
49+
github.repository == 'WordPress/wordpress-develop' || (
50+
github.event_name == 'pull_request' && (
51+
! github.event.repository.private ||
52+
! github.event.pull_request.draft ||
53+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
54+
)
55+
)
56+
)
4857
permissions:
4958
contents: read
5059

@@ -87,7 +96,14 @@ jobs:
8796
upgrade-tests-develop-forks:
8897
name: Upgrade from ${{ matrix.wp }}
8998
uses: WordPress/wordpress-develop/.github/workflows/reusable-upgrade-testing.yml@trunk
90-
if: ${{ github.repository != 'WordPress/wordpress-develop' }}
99+
# This job also runs for the push event, which has no draft state to check.
100+
if: |
101+
github.repository != 'WordPress/wordpress-develop' && (
102+
github.event_name != 'pull_request' ||
103+
! github.event.repository.private ||
104+
! github.event.pull_request.draft ||
105+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
106+
)
91107
needs: [ build ]
92108
permissions:
93109
contents: read

0 commit comments

Comments
 (0)