Skip to content

Commit 1a0ec76

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 0868e96 commit 1a0ec76

6 files changed

Lines changed: 56 additions & 7 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.4'
5360

@@ -57,7 +64,14 @@ jobs:
5764
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
5865
permissions:
5966
contents: read
60-
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
67+
if: |
68+
github.repository == 'WordPress/wordpress-develop' || (
69+
github.event_name == 'pull_request' && (
70+
! github.event.repository.private ||
71+
! github.event.pull_request.draft ||
72+
contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
73+
)
74+
)
6175
6276
slack-notifications:
6377
name: Slack Notifications

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ jobs:
3535
uses: WordPress/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@trunk
3636
permissions:
3737
contents: read
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/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/php-compatibility.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-php-compatibility.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
with:
4653
php-version: '7.4'
4754

‎.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)