Skip to content

Commit b6f9c53

Browse files
authored
Disable all GitHub Actions jobs in forks (quantumlib#7326)
* Disable all GitHub Actions jobs in forks Avoid spending users GHA resources on our CI jobs in GitHub forks. Downstream Cirq forks can remove the if-guard should they desire to execute workflows. Ref: https://github.com/orgs/community/discussions/26704 * Guard GitHub Actions execution by repository_owner
1 parent af63d6a commit b6f9c53

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

.github/workflows/ci-daily.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions: read-all
1414

1515
jobs:
1616
pytest:
17+
if: github.repository_owner == 'quantumlib'
1718
name: Pytest Ubuntu
1819
strategy:
1920
matrix:
@@ -50,6 +51,7 @@ jobs:
5051
- name: Stop Quil dependencies
5152
run: docker compose -f cirq-rigetti/docker-compose.test.yaml down
5253
windows:
54+
if: github.repository_owner == 'quantumlib'
5355
name: Pytest Windows
5456
strategy:
5557
matrix:
@@ -77,6 +79,7 @@ jobs:
7779
run: check/pytest -n auto --ignore=cirq-core/cirq/contrib --enable-slow-tests
7880
shell: bash
7981
macos:
82+
if: github.repository_owner == 'quantumlib'
8083
name: Pytest MacOS
8184
strategy:
8285
matrix:

.github/workflows/ci-weekly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions: read-all
1414

1515
jobs:
1616
notebooks-stable:
17+
if: github.repository_owner == 'quantumlib'
1718
name: All Notebooks Isolated Test against Cirq stable
1819
env:
1920
NOTEBOOK_PARTITIONS: 4

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ permissions: read-all
2020

2121
jobs:
2222
quick_test:
23+
if: github.repository_owner == 'quantumlib'
2324
name: Misc check
2425
runs-on: ubuntu-22.04
2526
steps:
@@ -33,6 +34,7 @@ jobs:
3334
- name: Misc
3435
run: check/misc
3536
packaging_test:
37+
if: github.repository_owner == 'quantumlib'
3638
name: Packaging test
3739
runs-on: ubuntu-22.04
3840
steps:
@@ -48,6 +50,7 @@ jobs:
4850
- name: Run packaging test
4951
run: ./dev_tools/packaging/packaging_test.sh
5052
format:
53+
if: github.repository_owner == 'quantumlib'
5154
name: Format check
5255
runs-on: ubuntu-22.04
5356
steps:
@@ -65,6 +68,7 @@ jobs:
6568
- name: Format
6669
run: check/format-incremental
6770
mypy:
71+
if: github.repository_owner == 'quantumlib'
6872
name: Type check
6973
runs-on: ubuntu-22.04
7074
steps:
@@ -80,6 +84,7 @@ jobs:
8084
- name: Type check
8185
run: check/mypy
8286
changed_files:
87+
if: github.repository_owner == 'quantumlib'
8388
name: Changed files test
8489
runs-on: ubuntu-22.04
8590
steps:
@@ -97,6 +102,7 @@ jobs:
97102
- name: Changed files test
98103
run: check/pytest-changed-files -n auto
99104
lint:
105+
if: github.repository_owner == 'quantumlib'
100106
name: Lint check
101107
runs-on: ubuntu-22.04
102108
steps:
@@ -114,6 +120,7 @@ jobs:
114120
- name: Lint
115121
run: check/pylint -v
116122
doc_test:
123+
if: github.repository_owner == 'quantumlib'
117124
name: Doc test
118125
runs-on: ubuntu-22.04
119126
steps:
@@ -129,6 +136,7 @@ jobs:
129136
- name: Doc check
130137
run: check/doctest -q
131138
nbformat:
139+
if: github.repository_owner == 'quantumlib'
132140
name: Notebook formatting
133141
runs-on: ubuntu-22.04
134142
steps:
@@ -144,6 +152,7 @@ jobs:
144152
- name: Doc check
145153
run: check/nbformat
146154
shellcheck:
155+
if: github.repository_owner == 'quantumlib'
147156
name: Shell check
148157
runs-on: ubuntu-22.04
149158
steps:
@@ -154,6 +163,7 @@ jobs:
154163
- name: Run shellcheck
155164
run: check/shellcheck
156165
isolated-modules:
166+
if: github.repository_owner == 'quantumlib'
157167
name: Isolated pytest Ubuntu
158168
runs-on: ubuntu-22.04
159169
steps:
@@ -169,6 +179,7 @@ jobs:
169179
- name: Test each module in isolation
170180
run: pytest -n auto --enable-slow-tests dev_tools/packaging/isolated_packages_test.py
171181
pytest:
182+
if: github.repository_owner == 'quantumlib'
172183
name: Pytest Ubuntu
173184
strategy:
174185
matrix:
@@ -202,6 +213,7 @@ jobs:
202213
run: docker compose -f cirq-rigetti/docker-compose.test.yaml down
203214
# TODO(#6706) remove after we start using NumPy 2.0 in regular pytest
204215
pytest-numpy-2:
216+
if: github.repository_owner == 'quantumlib'
205217
name: Pytest Ubuntu with NumPy-2
206218
strategy:
207219
matrix:
@@ -230,6 +242,7 @@ jobs:
230242
- name: Pytest check
231243
run: check/pytest -n auto --durations=20 --ignore=cirq-rigetti
232244
pip-compile:
245+
if: github.repository_owner == 'quantumlib'
233246
name: Check consistency of requirements
234247
runs-on: ubuntu-22.04
235248
steps:
@@ -246,6 +259,7 @@ jobs:
246259
run: |
247260
pip-compile --resolver=backtracking dev_tools/requirements/deps/cirq-all.txt -o-
248261
build_protos:
262+
if: github.repository_owner == 'quantumlib'
249263
name: Build protos
250264
runs-on: ubuntu-22.04
251265
steps:
@@ -264,6 +278,7 @@ jobs:
264278
- name: Build protos
265279
run: check/protos-up-to-date
266280
coverage:
281+
if: github.repository_owner == 'quantumlib'
267282
name: Coverage check
268283
runs-on: ubuntu-22.04
269284
steps:
@@ -299,6 +314,7 @@ jobs:
299314
- name: Stop Quil dependencies
300315
run: docker compose -f cirq-rigetti/docker-compose.test.yaml down
301316
windows:
317+
if: github.repository_owner == 'quantumlib'
302318
name: Pytest Windows
303319
strategy:
304320
matrix:
@@ -326,6 +342,7 @@ jobs:
326342
check/pytest -n auto --durations=20 --ignore=cirq-core/cirq/contrib
327343
shell: bash
328344
macos:
345+
if: github.repository_owner == 'quantumlib'
329346
name: Pytest MacOS
330347
strategy:
331348
matrix:
@@ -350,6 +367,7 @@ jobs:
350367
- name: Pytest check
351368
run: check/pytest -n auto --durations=20 --ignore=cirq-core/cirq/contrib
352369
notebooks-stable:
370+
if: github.repository_owner == 'quantumlib'
353371
name: Changed Notebooks Isolated Test against Cirq stable
354372
env:
355373
NOTEBOOK_PARTITIONS: 4
@@ -379,6 +397,7 @@ jobs:
379397
name: notebook-outputs
380398
path: out
381399
notebooks-branch:
400+
if: github.repository_owner == 'quantumlib'
382401
name: Notebook Tests against PR
383402
runs-on: ubuntu-22.04
384403
steps:
@@ -400,6 +419,7 @@ jobs:
400419
name: notebook-outputs
401420
path: out
402421
ts-build:
422+
if: github.repository_owner == 'quantumlib'
403423
name: Bundle file consistency
404424
runs-on: ubuntu-22.04
405425
steps:
@@ -414,6 +434,7 @@ jobs:
414434
- name: Check build matches the current
415435
run: check/ts-build-current
416436
ts-lint:
437+
if: github.repository_owner == 'quantumlib'
417438
name: Typescript lint check
418439
runs-on: ubuntu-22.04
419440
steps:
@@ -428,6 +449,7 @@ jobs:
428449
- name: Lint Typescript files
429450
run: check/ts-lint
430451
ts-test:
452+
if: github.repository_owner == 'quantumlib'
431453
name: Typescript tests
432454
runs-on: ubuntu-22.04
433455
steps:
@@ -444,6 +466,7 @@ jobs:
444466
- name: Run end-to-end tests
445467
run: check/ts-test-e2e
446468
ts-coverage:
469+
if: github.repository_owner == 'quantumlib'
447470
name: Typescript tests coverage
448471
runs-on: ubuntu-22.04
449472
steps:

.github/workflows/ossf-scorecard.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ concurrency:
2929

3030
jobs:
3131
scorecard:
32+
if: github.repository_owner == 'quantumlib'
3233
name: Perform Scorecard analysis
3334
runs-on: ubuntu-22.04
3435
timeout-minutes: 10

.github/workflows/pr-labeler.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ permissions: read-all
4949

5050
jobs:
5151
label-pr-size:
52+
if: github.repository_owner == 'quantumlib'
5253
name: Update PR size labels
5354
runs-on: ubuntu-24.04
5455
timeout-minutes: 5

.github/workflows/stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ permissions: read-all
6161

6262
jobs:
6363
stale:
64+
if: github.repository_owner == 'quantumlib'
6465
name: Label and/or close stale issues and PRs
6566
runs-on: ubuntu-22.04
6667
timeout-minutes: 10

0 commit comments

Comments
 (0)