Skip to content

Commit 496ffe2

Browse files
authored
Better CI workflow with Permissions check as a short circuit (#143)
1 parent e1f7dd6 commit 496ffe2

File tree

2 files changed

+25
-71
lines changed

2 files changed

+25
-71
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
name: CI
33

44
on:
5-
workflow_run:
6-
workflows: ["gate"]
7-
types: [requested, completed]
8-
# push:
9-
# branches: [ "main", "dev/robgruen/workflow_updates" ]
10-
# pull_request_target:
11-
# branches: [ "main" ]
5+
push:
6+
branches: [ "main" ]
7+
pull_request_target:
8+
branches: [ "main" ]
129
workflow_dispatch: # manual run
1310

1411
concurrency:
@@ -23,25 +20,8 @@ permissions:
2320

2421
jobs:
2522

26-
ci:
27-
environment:
28-
name: build-pipeline
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
os: [ubuntu-latest, windows-latest]
33-
python-version: ['3.12', '3.13', '3.14']
34-
task: [check, test, format]
35-
exclude:
36-
- os: windows-latest
37-
python-version: '3.13'
38-
- os: windows-latest
39-
python-version: '3.14'
40-
runs-on: ${{ matrix.os }}
41-
name: ${{ matrix.os }} ${{ matrix.task }} (py ${{ matrix.python-version }})
42-
43-
# Only run this job if the Gate workflow succeeded or if manually triggered
44-
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
23+
permissions-check:
24+
runs-on: ubuntu-latest
4525
steps:
4626

4727
# The following two steps (permissions checks) ensure that only users with write access can run this workflow on a PR (except the merge queue bot)
@@ -66,6 +46,25 @@ jobs:
6646
echo "Job originally triggered by ${{ github.actor }}"
6747
exit 1
6848
49+
ci:
50+
needs: permissions-check
51+
environment:
52+
name: build-pipeline
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
os: [ubuntu-latest, windows-latest]
57+
python-version: ['3.12', '3.13', '3.14']
58+
task: [check, test, format]
59+
exclude:
60+
- os: windows-latest
61+
python-version: '3.13'
62+
- os: windows-latest
63+
python-version: '3.14'
64+
runs-on: ${{ matrix.os }}
65+
name: ${{ matrix.os }} ${{ matrix.task }} (py ${{ matrix.python-version }})
66+
67+
steps:
6968
- uses: actions/checkout@v4
7069
with:
7170
ref: ${{ github.event.pull_request.head.sha || github.ref }}

.github/workflows/gate.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)