Skip to content

Commit 4c1bf66

Browse files
authored
feat: provide stable-named job for branch protection (#124)
* feat: provide stable-named job for branch protection GitHub actions matrix "test" gets expanded to many status checks, making it impossible to keep the branch protection settings in the GitHub UI up-to-date as the matrix cells are updated. This provides a "conclusion" status which can be used instead. Thanks @mattmoor for the code! * Update ci.yaml
1 parent 4304489 commit 4c1bf66

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,23 @@ jobs:
2929
[
3030
{"folder": ".", "bzlmodEnabled": false}
3131
]
32+
# For branch protection settings, this job provides a "stable" name that can be used to gate PR merges
33+
# on "all matrix jobs were successful".
34+
conclusion:
35+
needs: test
36+
runs-on: ubuntu-latest
37+
if: always()
38+
steps:
39+
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3
40+
41+
# Note: possible conclusion values:
42+
# https://github.com/technote-space/workflow-conclusion-action/blob/main/src/constant.ts
43+
- name: report success
44+
if: ${{ env.WORKFLOW_CONCLUSION == 'success' }}
45+
working-directory: /tmp
46+
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0
47+
48+
- name: report failure
49+
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }}
50+
working-directory: /tmp
51+
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 1

0 commit comments

Comments
 (0)