Skip to content

Commit 98636ff

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. Merges [65249] to the 6.8 branch. Props lancewillett. See #65845.
1 parent 0131bb4 commit 98636ff

14 files changed

Lines changed: 28 additions & 28 deletions

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

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

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

3737
# Disable permissions for all available scopes by default.

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

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

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

4040
# 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
@@ -33,9 +33,9 @@ on:
3333

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

4141
# 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
@@ -33,9 +33,9 @@ on:
3333

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

4141
# 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
@@ -53,9 +53,9 @@ on:
5353

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

6161
# 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
@@ -33,9 +33,9 @@ on:
3333

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

4141
# 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
@@ -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
@@ -56,9 +56,9 @@ on:
5656

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

6464
# Disable permissions for all available scopes by default.

‎.github/workflows/props-bot.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 }}-${{ contains( fromJSON( '["pull_request_target", "pull_request_review", "pull_request_review_comment"]' ), github.event_name ) && github.head_ref || github.sha }}
36+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.sha }}
3737
cancel-in-progress: true
3838

3939
# Disable permissions for all available scopes by default.

‎.github/workflows/pull-request-comments.yml‎

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

1212
# Cancels all previous workflow runs for pull requests that have not completed.
1313
concurrency:
14-
# The concurrency group contains the workflow name and the branch name for pull requests
14+
# The concurrency group contains the workflow name and the pull request number for pull requests
1515
# or the commit hash for any other events.
16-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && github.event.number || github.sha }}
16+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.event_name == 'workflow_dispatch' && github.event.number || github.sha }}
1717

1818
# Disable permissions for all available scopes by default.
1919
# Any needed permissions should be configured at the job level.

0 commit comments

Comments
 (0)