Skip to content

Commit 81ffc08

Browse files
authored
fix(ci): use PR number in MicroShift workflow concurrency group (kroxylicious#3583)
* fix(ci): use PR number in MicroShift workflow concurrency group When triggered via workflow_run, github.ref resolves to refs/heads/main for all PRs, causing every PR build to share the same concurrency group and cancel each other. Use github.event.workflow_run.pull_requests[0].number (the originating PR number) so each PR gets its own group, consistent with other workflows that use github.event.pull_request.number || github.ref. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Sam Barker <sam@quadrocket.co.uk> * fix(ci): use head_branch for concurrency group and head_sha for checkout For workflow_run triggers, github.event.pull_request is unavailable. Using head_branch for the concurrency group is more reliable than pull_requests[0].number and works for fork PRs too. Checking out head_sha ensures we test the PR's actual code rather than always defaulting to the main branch — the previous bug meant every workflow_run trigger ran the main branch, not the PR under test. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Sam Barker <sam@quadrocket.co.uk> --------- Signed-off-by: Sam Barker <sam@quadrocket.co.uk>
1 parent 65cf01e commit 81ffc08

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

.github/workflows/operator-tests-microshift.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ on:
4444
required: false
4545

4646
concurrency:
47-
group: ${{ github.workflow }}-${{ github.ref }}
47+
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
4848
cancel-in-progress: true
4949

5050
jobs:
@@ -54,9 +54,6 @@ jobs:
5454
outputs:
5555
pull-secret-check: ${{ steps.pull-check.outputs.pullsecret }}
5656
steps:
57-
- name: Checkout source
58-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
59-
6057
- name: 'Test for presence of Red Hat pull-secret'
6158
id: pull-check
6259
env:
@@ -84,6 +81,8 @@ jobs:
8481
8582
- name: Checkout source
8683
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
84+
with:
85+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
8786

8887
- name: Setup Java
8988
uses: ./.github/actions/common/setup-java

0 commit comments

Comments
 (0)