Skip to content

Commit 0676226

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 7.0 branch. Props lancewillett. See #65845.
1 parent 8fb33d4 commit 0676226

15 files changed

Lines changed: 30 additions & 30 deletions

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

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

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

4444
# 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
@@ -34,9 +34,9 @@ on:
3434

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

4242
# 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
@@ -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 }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
42+
group: ${{ github.workflow }}-${{ 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
@@ -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 }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
42+
group: ${{ github.workflow }}-${{ 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-type-checking.yml‎

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

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

3838
# 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
@@ -60,9 +60,9 @@ on:
6060

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

6868
# 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
@@ -38,9 +38,9 @@ on:
3838

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

4646
# 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/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
@@ -60,9 +60,9 @@ on:
6060

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

6868
# Disable permissions for all available scopes by default.

0 commit comments

Comments
 (0)