Skip to content

Commit 729bbaa

Browse files
authored
fix(ci): preserve unit test result on label events (#10998)
2 parents d98c933 + 29a4384 commit 729bbaa

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/tests-unit.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ on:
88
branches: [main]
99
merge_group:
1010

11-
# Ensures that only one workflow task will run at a time. Previous builds, if
12-
# already in process, will get cancelled. Only the latest commit will be allowed
13-
# to run, cancelling any workflows in between
11+
# Cancel obsolete test runs after new commits. Unrelated label events use a
12+
# separate group so they cannot cancel the required unit test run.
1413
concurrency:
15-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
group: >-
15+
${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{
16+
github.event.action == 'labeled' &&
17+
github.event.label.name != 'A-release' &&
18+
'ignored-label' ||
19+
'required'
20+
}}
1621
cancel-in-progress: true
1722

1823
permissions:
@@ -98,6 +103,14 @@ jobs:
98103
run: cargo nextest run --profile check-no-git-dependencies --locked --run-ignored=only
99104

100105
unit-tests:
106+
# Keep skipped unrelated-label runs from replacing the required check.
107+
name: >-
108+
${{
109+
github.event.action == 'labeled' &&
110+
github.event.label.name != 'A-release' &&
111+
'Label does not require unit tests' ||
112+
'unit-tests'
113+
}}
101114
runs-on: ubuntu-latest
102115
if: >-
103116
always() &&

0 commit comments

Comments
 (0)