Skip to content

Commit dcbb4b1

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 5.9 branch. Props lancewillett. See #65845.
1 parent f496689 commit dcbb4b1

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎.github/workflows/coding-standards.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/end-to-end-tests.yml‎

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

1717
# Cancels all previous workflow runs for pull requests that have not completed.
1818
concurrency:
19-
# The concurrency group contains the workflow name and the branch name for pull requests
19+
# The concurrency group contains the workflow name and the pull request number for pull requests
2020
# or the commit hash for any other events.
21-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
21+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
2222
cancel-in-progress: true
2323

2424
# 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
@@ -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/php-compatibility.yml‎

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

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

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

1919
# Cancels all previous workflow runs for pull requests that have not completed.
2020
concurrency:
21-
# The concurrency group contains the workflow name and the branch name for pull requests
21+
# The concurrency group contains the workflow name and the pull request number for pull requests
2222
# or the commit hash for any other events.
23-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
23+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
2424
cancel-in-progress: true
2525

2626
# Disable permissions for all available scopes by default.

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

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

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

3333
# Disable permissions for all available scopes by default.

0 commit comments

Comments
 (0)