Skip to content

Commit 23b29f4

Browse files
committed
.github: alternative fix to issue #1154
Here we use a check-trigger job that all the others depend on, which should prevent duplicate workflows starting a bit more elegantly than killing one of them with the concurrency checker. Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 7a7505d commit 23b29f4

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/trigger.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,47 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
# Gate all builds through this check to prevent wasted runs. Only run on
18+
# 'labeled' events when the label is actually 'ci:main'. Concurrency control
19+
# above handles canceling the 'opened' event when 'labeled' arrives quickly
20+
# after (e.g., when creating a PR with ci:main already attached). See #1154.
21+
check-trigger:
22+
if: |
23+
startsWith(github.repository, 'kernelkit/') &&
24+
(github.event_name != 'pull_request' ||
25+
github.event.action != 'labeled' ||
26+
github.event.label.name == 'ci:main')
27+
runs-on: ubuntu-latest
28+
steps:
29+
- run: |
30+
echo "Triggering build ——————————————————————————————————————————————"
31+
echo "Event : ${{ github.event_name }}"
32+
echo "Action : ${{ github.event.action }}"
33+
echo "Ref : ${{ github.ref }}"
34+
echo "PR : ${{ github.event.pull_request.number }}"
35+
echo "Label : ${{ github.event.label.name }}"
36+
1737
build-x86_64:
18-
if: startsWith(github.repository, 'kernelkit/')
38+
needs: check-trigger
1939
uses: ./.github/workflows/build.yml
2040
with:
2141
name: "infix"
2242
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
2343

2444
build-aarch64:
25-
if: startsWith(github.repository, 'kernelkit/')
45+
needs: check-trigger
2646
uses: ./.github/workflows/build.yml
2747
with:
2848
name: "infix"
2949
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'aarch64_minimal' || 'aarch64' }}
3050

3151
test-run-x86_64:
32-
if: startsWith(github.repository, 'kernelkit/')
3352
needs: build-x86_64
3453
uses: ./.github/workflows/test.yml
3554
with:
3655
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
3756
name: "infix"
3857

3958
test-publish-x86_64:
40-
if: startsWith(github.repository, 'kernelkit/')
4159
needs: test-run-x86_64
4260
uses: ./.github/workflows/publish.yml

0 commit comments

Comments
 (0)