Skip to content

Commit 8b0dfb2

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 2f91987 commit 8b0dfb2

4 files changed

Lines changed: 40 additions & 5 deletions

File tree

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ jobs:
4747
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
4848
permissions:
4949
contents: read
50-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
50+
if: |
51+
github.repository == 'WordPress/wordpress-develop' || (
52+
github.event_name == 'pull_request' && (
53+
! github.event.repository.private ||
54+
! github.event.pull_request.draft ||
55+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
56+
)
57+
)
5158
with:
5259
php-version: '7.3'
5360
old-branch: true
@@ -58,7 +65,14 @@ jobs:
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/javascript-tests.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ jobs:
4545
uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
4646
permissions:
4747
contents: read
48-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
48+
if: |
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+
)
4956
with:
5057
disable-apparmor: true
5158

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ jobs:
3535
permissions:
3636
contents: read
3737
secrets: inherit
38-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
38+
if: |
39+
github.repository == 'WordPress/wordpress-develop' || (
40+
github.event_name == 'pull_request' && (
41+
! github.event.repository.private ||
42+
! github.event.pull_request.draft ||
43+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
44+
)
45+
)
3946
strategy:
4047
fail-fast: false
4148
matrix:

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ jobs:
4141
uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
4242
permissions:
4343
contents: read
44-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
44+
if: |
45+
github.repository == 'WordPress/wordpress-develop' || (
46+
github.event_name == 'pull_request' && (
47+
! github.event.repository.private ||
48+
! github.event.pull_request.draft ||
49+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
50+
)
51+
)
4552
strategy:
4653
fail-fast: false
4754
matrix:

0 commit comments

Comments
 (0)