Skip to content

Commit 4ecbf49

Browse files
ci: Restrict deployment workflows to not run on forks (#2617)
* Restrict workflows involving deployment or repository specific secrets to to only run on the scikit-hep/pyhf repository and not forks. * Also restrict workflows that run on nightly schedules so if there are failures it doesn't create noise on forks.
1 parent be9ee54 commit 4ecbf49

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ jobs:
7171
- name: Report core project coverage with Codecov
7272
if: >-
7373
github.event_name != 'schedule' &&
74-
matrix.os == 'ubuntu-latest'
74+
matrix.os == 'ubuntu-latest' &&
75+
github.repository == 'scikit-hep/pyhf'
7576
uses: codecov/codecov-action@v5
7677
with:
7778
fail_ci_if_error: true
@@ -89,7 +90,7 @@ jobs:
8990
coverage xml
9091
9192
- name: Report contrib coverage with Codecov
92-
if: github.event_name != 'schedule' && matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'
93+
if: github.event_name != 'schedule' && matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' && github.repository == 'scikit-hep/pyhf'
9394
uses: codecov/codecov-action@v5
9495
with:
9596
fail_ci_if_error: true
@@ -109,7 +110,7 @@ jobs:
109110
coverage xml --data-file=.coverage-doctest -o doctest-coverage.xml
110111
111112
- name: Report doctest coverage with Codecov
112-
if: github.event_name != 'schedule' && matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'
113+
if: github.event_name != 'schedule' && matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' && github.repository == 'scikit-hep/pyhf'
113114
uses: codecov/codecov-action@v5
114115
with:
115116
fail_ci_if_error: true

.github/workflows/dependencies-head.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ permissions:
1616
jobs:
1717
release-candidates:
1818

19+
if: github.repository == 'scikit-hep/pyhf'
1920
runs-on: ${{ matrix.os }}
2021
strategy:
2122
matrix:
@@ -46,6 +47,7 @@ jobs:
4647
4748
scipy:
4849

50+
if: github.repository == 'scikit-hep/pyhf'
4951
runs-on: ${{ matrix.os }}
5052
strategy:
5153
matrix:
@@ -75,6 +77,7 @@ jobs:
7577
7678
iminuit:
7779

80+
if: github.repository == 'scikit-hep/pyhf'
7881
runs-on: ${{ matrix.os }}
7982
strategy:
8083
matrix:
@@ -101,6 +104,7 @@ jobs:
101104
102105
uproot5:
103106

107+
if: github.repository == 'scikit-hep/pyhf'
104108
runs-on: ${{ matrix.os }}
105109
strategy:
106110
matrix:
@@ -126,6 +130,7 @@ jobs:
126130
127131
matplotlib:
128132

133+
if: github.repository == 'scikit-hep/pyhf'
129134
runs-on: ${{ matrix.os }}
130135
strategy:
131136
matrix:
@@ -164,6 +169,7 @@ jobs:
164169
165170
pytest:
166171

172+
if: github.repository == 'scikit-hep/pyhf'
167173
runs-on: ${{ matrix.os }}
168174
strategy:
169175
matrix:

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ jobs:
6565
uses: docker/setup-buildx-action@v3
6666

6767
- name: Login to DockerHub
68-
if: github.event_name != 'pull_request'
68+
if: github.event_name != 'pull_request' && github.repository == 'scikit-hep/pyhf'
6969
uses: docker/login-action@v3
7070
with:
7171
username: ${{ secrets.DOCKERHUB_USERNAME }}
7272
password: ${{ secrets.DOCKERHUB_TOKEN }}
7373

7474
- name: Login to GitHub Container Registry
75-
if: github.event_name != 'pull_request'
75+
if: github.event_name != 'pull_request' && github.repository == 'scikit-hep/pyhf'
7676
uses: docker/login-action@v3
7777
with:
7878
registry: ghcr.io

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100

101101
deploy:
102102
name: Deploy docs to GitHub Pages
103-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
103+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'scikit-hep/pyhf'
104104
needs: build
105105
# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
106106
permissions:

.github/workflows/release_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
pypi_release:
1919

20+
if: github.repository == 'scikit-hep/pyhf'
2021
runs-on: ${{ matrix.os }}
2122
strategy:
2223
matrix:

0 commit comments

Comments
 (0)