Skip to content

Commit

Permalink
Inject check job into CI workflow as ultimate flag (#55)
Browse files Browse the repository at this point in the history
This patch adds a job that is able to accurately signal whether
all the expectations of the required jobs to succeed are met.

This job can then be used as a source of truth for judging whether
"CI passes" and can be used in the branch protection. It also plays
a role of a convenient "gate" — this is the only job that would have
to be listed in the branch protection as opposed to listing every
single job name generated by the test matrix (and they all have
different names — it's not possible to just select one `test` job
name).

Ref: https://github.com/re-actors/alls-green#why
  • Loading branch information
webknjaz authored Apr 22, 2022
1 parent 04fe68a commit 1a6b828
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,23 @@ jobs:
- name: Run tests
run: tox

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

release:
needs: test
needs:
- check
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

Expand Down

0 comments on commit 1a6b828

Please sign in to comment.