Prevent redundant runs and potential concurrency collisions with Merge Queue
When a PR enters the merge queue, GitHub triggers both a 'merge_group' and a 'push' event. These events might share the same concurrency key as they both reference the temporary 'gh-readonly-queue/' branch. This creates a race condition where the redundant 'push' job could incorrectly cancel the official 'merge_group' run. This commit adds an explicit filter to ignore 'push' events on queue branches, ensuring CI stability and saving runner minutes.
This commit is contained in:
parent
e3eff7061f
commit
8d1ead4eef
2 changed files with 19 additions and 4 deletions
3
.github/workflows/docker.yml
vendored
3
.github/workflows/docker.yml
vendored
|
|
@ -24,6 +24,9 @@ concurrency:
|
|||
jobs:
|
||||
build:
|
||||
uses: docker/github-builder/.github/workflows/build.yml@v1
|
||||
# Exclude 'push' events from the Merge Queue to avoid a race condition where
|
||||
# the 'push' event might cancel the 'merge_group' event via the concurrency group.
|
||||
if: (!(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/gh-readonly-queue/')))
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
|
|
|||
20
.github/workflows/oxipng.yml
vendored
20
.github/workflows/oxipng.yml
vendored
|
|
@ -19,8 +19,14 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
|
||||
# Prevent tags and in-repo PRs from triggering this workflow more than once for a commit
|
||||
if: github.ref_type != 'tag' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
|
||||
# Prevent tags and in-repo PRs from triggering this workflow more than once for a commit.
|
||||
# We also exclude 'push' events from the Merge Queue (gh-readonly-queue/) because they
|
||||
# trigger alongside the 'merge_group' event. Without this, a race condition in the
|
||||
# concurrency group could cause the 'push' event to cancel the 'merge_group' event.
|
||||
if: >-
|
||||
github.ref_type != 'tag' &&
|
||||
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) &&
|
||||
(!(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/gh-readonly-queue/')))
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
|
@ -154,8 +160,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
# Prevent tags and in-repo PRs from triggering this workflow more than once for a commit
|
||||
if: github.ref_type != 'tag' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
|
||||
# Prevent tags and in-repo PRs from triggering this workflow more than once for a commit.
|
||||
# We also exclude 'push' events from the Merge Queue (gh-readonly-queue/) because they
|
||||
# trigger alongside the 'merge_group' event. Without this, a race condition in the
|
||||
# concurrency group could cause the 'push' event to cancel the 'merge_group' event.
|
||||
if: >-
|
||||
github.ref_type != 'tag' &&
|
||||
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) &&
|
||||
(!(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/gh-readonly-queue/')))
|
||||
|
||||
steps:
|
||||
- name: Checkout source
|
||||
|
|
|
|||
Loading…
Reference in a new issue