Skip to content

Commit a0fac98

Browse files
authored
Introduce a check CI job for branch protection (#11434)
This patch adds a special check-job that produces a clear failure or success status based on how the dependent jobs are doing. It is possible to use it in GitHub's branch protection instead of having to manually add and remove individual job names via the repo settings. https://github.com/marketplace/actions/alls-green#why
1 parent 0a21080 commit a0fac98

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,34 @@ jobs:
284284
-m integration
285285
--verbose --numprocesses auto --showlocals
286286
--durations=5
287+
288+
check: # This job does nothing and is only used for the branch protection
289+
if: always()
290+
291+
needs:
292+
- determine-changes
293+
- docs
294+
- packaging
295+
- pre-commit
296+
- tests-unix
297+
- tests-windows
298+
- tests-zipapp
299+
- tests-importlib-metadata
300+
- vendoring
301+
302+
runs-on: ubuntu-latest
303+
304+
steps:
305+
- name: Decide whether the needed jobs succeeded or failed
306+
uses: re-actors/alls-green@release/v1
307+
with:
308+
allowed-skips: >-
309+
${{
310+
(
311+
needs.determine-changes.outputs.vendoring != 'true'
312+
&& github.event_name == 'pull_request'
313+
)
314+
&& 'vendoring'
315+
|| ''
316+
}}
317+
jobs: ${{ toJSON(needs) }}

news/c57bc03f-7001-4ff0-a100-c36496ff8758.trivial.rst

Whitespace-only changes.

0 commit comments

Comments
 (0)