Skip to content

Commit

Permalink
feat: provide stable-named job for branch protection (#124)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alexeagle authored Jul 19, 2024
1 parent 4304489 commit 4c1bf66
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@ jobs:
[
{"folder": ".", "bzlmodEnabled": false}
]
# For branch protection settings, this job provides a "stable" name that can be used to gate PR merges
# on "all matrix jobs were successful".
conclusion:
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3

# Note: possible conclusion values:
# https://github.com/technote-space/workflow-conclusion-action/blob/main/src/constant.ts
- name: report success
if: ${{ env.WORKFLOW_CONCLUSION == 'success' }}
working-directory: /tmp
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0

- name: report failure
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }}
working-directory: /tmp
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 1

0 comments on commit 4c1bf66

Please sign in to comment.