Skip to content

Commit fb8bddb

Browse files
committed
Use !cancelled() in required-status-check
When the build is cancelled by concurrency (e.g. a 'test *' label triggers a rebuild via rebuild-pull-request-on-label.yml), the superseded run's required-status-check used to run with always() and report failure (because needs.*.result was 'cancelled'). Branch protection then showed the PR as red until the rebuild completed. Switching to !cancelled() makes the superseded check-run be reported as skipped instead, and branch protection resolves the same-named check from the rebuild.
1 parent 4d87435 commit fb8bddb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/build-pull-request.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ jobs:
6969
- muzzle
7070
- markdown-lint-check
7171
runs-on: ubuntu-latest
72-
if: always()
72+
# `!cancelled()` (instead of `always()`) makes this a "skipped" check-run
73+
# when the workflow is cancelled by concurrency (e.g. when a "test *"
74+
# label triggers a rebuild via rebuild-pull-request-on-label.yml). That
75+
# avoids a noisy red "required-status-check failed" on the superseded
76+
# run; the rebuild produces a same-named check that branch protection
77+
# resolves to success.
78+
if: ${{ !cancelled() }}
7379
steps:
7480
- if: |
7581
needs.common.result != 'success' ||

0 commit comments

Comments
 (0)