Skip to content

Commit 29514c8

Browse files
committed
Introduce a centralized GHA check/gate job
This patch is intended to lower the maintenance burden of having to manually go through each matrix subjob name in the branch protection repository settings. It allows to only include the `check` job in the branch protection and it will robustly determine if the dependencies have succeeded or not. It is currently mostly serves the Python ecosystem in projects like aiohttp, attrs, cryptography, pydantic, open edX, pip etc. But I've also seen other communities picking it up lately, like the AWS Rust SDK and even the engine powering https://dev.to, to my surprise. Strictly speaking, it is agnostic. Ref: https://github.com/marketplace/actions/alls-green#why
1 parent 4475cf1 commit 29514c8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ jobs:
4545
- "tox"
4646
- "min"
4747

48+
continue-on-error: >- # jobs not required in branch protection
49+
${{
50+
(
51+
(
52+
startsWith(matrix.py, 'pypy-')
53+
&& (!endsWith(matrix.py, '-3.7') || matrix.os == 'windows')
54+
)
55+
|| matrix.py == '3.11'
56+
)
57+
&& true
58+
|| false
59+
}}
60+
4861
steps:
4962
- uses: actions/checkout@v3
5063
with:
@@ -128,3 +141,19 @@ jobs:
128141

129142
- name: Run check for type
130143
run: tox -e type --skip-pkg-install
144+
145+
# https://github.com/marketplace/actions/alls-green#why
146+
check: # This job does nothing and is only used for the branch protection
147+
if: always()
148+
149+
needs:
150+
- pytest
151+
- type
152+
153+
runs-on: ubuntu-latest
154+
155+
steps:
156+
- name: Decide whether the needed jobs succeeded or failed
157+
uses: re-actors/alls-green@release/v1
158+
with:
159+
jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)