Skip to content

Commit 5fa0439

Browse files
committed
Build/Test Tools: Use PR number for concurrency groups instead of head_ref.
The current standard across all GitHub Actions workflows is to configure `concurrency` to use the `github.head_ref` value in the `group` name for a given PR. Because `head_ref` only includes the branch name, workflow runs can be inadvertantly cancelled when two PRs are open from different forks with identical branch names. This switches to using the `github.event.pull_request.number` instead of `github.head_ref` to ensure that runs are properly grouped only with runs from the same pull request. A similar change has been made to `props-bot.yml`, which can be triggered by an `issue_comment` event. In this case, the `github.event.issue.number` will be used. In the context of GitHub, `issues == pull_requests` for the data returned by a number of request types. Props lancewillett. See #65845. git-svn-id: https://develop.svn.wordpress.org/trunk@65249 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 65b18f9 commit 5fa0439

18 files changed

Lines changed: 36 additions & 36 deletions

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ on:
7575

7676
# Cancels all previous workflow runs for pull requests that have not completed.
7777
concurrency:
78-
# The concurrency group contains the workflow name and the branch name for pull requests
78+
# The concurrency group contains the workflow name and the pull request number for pull requests
7979
# or the commit hash for any other events.
80-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
80+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
8181
cancel-in-progress: true
8282

8383
# Disable permissions for all available scopes by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ on:
5050

5151
# Cancels all previous workflow runs for pull requests that have not completed.
5252
concurrency:
53-
# The concurrency group contains the workflow name and the branch name for pull requests
53+
# The concurrency group contains the workflow name and the pull request number for pull requests
5454
# or the commit hash for any other events.
55-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
55+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
5656
cancel-in-progress: true
5757

5858
# Disable permissions for all available scopes by default.

‎.github/workflows/install-testing.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ on:
3737

3838
# Cancels all previous workflow runs for pull requests that have not completed.
3939
concurrency:
40-
# The concurrency group contains the workflow name and the branch name for pull requests
40+
# The concurrency group contains the workflow name and the pull request number for pull requests
4141
# or the commit hash for any other events.
42-
group: ${{ github.workflow }}-${{ inputs.wp-version || github.event_name == 'pull_request' && github.head_ref || github.sha }}
42+
group: ${{ github.workflow }}-${{ inputs.wp-version || github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
4343
cancel-in-progress: true
4444

4545
# Disable permissions for all available scopes by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ on:
7676

7777
# Cancels all previous workflow runs for pull requests that have not completed.
7878
concurrency:
79-
# The concurrency group contains the workflow name and the branch name for pull requests
79+
# The concurrency group contains the workflow name and the pull request number for pull requests
8080
# or the commit hash for any other events.
81-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
81+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
8282
cancel-in-progress: true
8383

8484
# Disable permissions for all available scopes by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ on:
3131

3232
# Cancels all previous workflow runs for pull requests that have not completed.
3333
concurrency:
34-
# The concurrency group contains the workflow name and the branch name for pull requests
34+
# The concurrency group contains the workflow name and the pull request number for pull requests
3535
# or the commit hash for any other events.
36-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
36+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
3737
cancel-in-progress: true
3838

3939
# Disable permissions for all available scopes by default.

‎.github/workflows/local-docker-environment.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ on:
6464

6565
# Cancels all previous workflow runs for pull requests that have not completed.
6666
concurrency:
67-
# The concurrency group contains the workflow name and the branch name for pull requests
67+
# The concurrency group contains the workflow name and the pull request number for pull requests
6868
# or the commit hash for any other events.
69-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
69+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
7070
cancel-in-progress: true
7171

7272
# Disable permissions for all available scopes by default.

‎.github/workflows/performance.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ on:
5151

5252
# Cancels all previous workflow runs for pull requests that have not completed.
5353
concurrency:
54-
# The concurrency group contains the workflow name and the branch name for pull requests
54+
# The concurrency group contains the workflow name and the pull request number for pull requests
5555
# or the commit hash for any other events.
56-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
56+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
5757
cancel-in-progress: true
5858

5959
# Disable permissions for all available scopes by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ on:
6464

6565
# Cancels all previous workflow runs for pull requests that have not completed.
6666
concurrency:
67-
# The concurrency group contains the workflow name and the branch name for pull requests
67+
# The concurrency group contains the workflow name and the pull request number for pull requests
6868
# or the commit hash for any other events.
69-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
69+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
7070
cancel-in-progress: true
7171

7272
# Disable permissions for all available scopes by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ on:
2626

2727
# Cancels all previous workflow runs for pull requests that have not completed.
2828
concurrency:
29-
# The concurrency group contains the workflow name and the branch name for pull requests
29+
# The concurrency group contains the workflow name and the pull request number for pull requests
3030
# or the commit hash for any other events.
31-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
31+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
3232
cancel-in-progress: true
3333

3434
# Disable permissions for all available scopes by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ on:
7474

7575
# Cancels all previous workflow runs for pull requests that have not completed.
7676
concurrency:
77-
# The concurrency group contains the workflow name and the branch name for pull requests
77+
# The concurrency group contains the workflow name and the pull request number for pull requests
7878
# or the commit hash for any other events.
79-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
79+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
8080
cancel-in-progress: true
8181

8282
# Disable permissions for all available scopes by default.

0 commit comments

Comments
 (0)