Skip to content

Commit 2b983db

Browse files
committed
Prevent GHA from running in forks
1 parent 0278982 commit 2b983db

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

.github/workflows/ci_publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
jobs:
2222

2323
publish_html:
24-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
24+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'Caltech-IPAC/irsa-tutorials' }}
2525
name: Publish HTML
2626
runs-on: ubuntu-latest
2727
steps:
@@ -46,7 +46,7 @@ jobs:
4646
commit_message: ${{ github.event.head_commit.message }}
4747

4848
deploy_notebooks:
49-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
49+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'Caltech-IPAC/irsa-tutorials' }}
5050
name: Deploy deployed_notebook branch
5151
runs-on: ubuntu-latest
5252
needs: publish_html
@@ -62,4 +62,4 @@ jobs:
6262
git rm --cached -r .
6363
git add --pathspec-from-file=deployed_notebooks_manifest.in --force
6464
git commit -m "Deploy notebooks for commit ${gith}"
65-
git push origin deployed_notebooks --force
65+
git push origin deployed_notebooks --force

.github/workflows/ci_tests_run_notebooks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
jobs:
1919
tests:
2020
# Do not run the test matrix on PRs affecting the rendering
21-
if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'html rendering / skip testing') }}
21+
if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'html rendering / skip testing') && github.repository == 'Caltech-IPAC/irsa-tutorials' }}
2222

2323
name: ${{ matrix.os }} ${{ matrix.name }}
2424
runs-on: ${{ matrix.os }}
@@ -59,7 +59,7 @@ jobs:
5959
gha_buildhtml:
6060
# When label is used, we do run buildhtml on GHA to check if the publishing job will run or not.
6161
# Use in case when new content has run into troubles on CircleCI.
62-
if: ${{ (github.event_name == 'pull_request') && contains(github.event.pull_request.labels.*.name, 'GHA buildhtml') }}
62+
if: ${{ (github.event_name == 'pull_request') && contains(github.event.pull_request.labels.*.name, 'GHA buildhtml') && github.repository == 'Caltech-IPAC/irsa-tutorials' }}
6363
name: Buildhtml testing
6464
runs-on: ubuntu-latest
6565
steps:

.github/workflows/circleci-artifacts-redirector.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Run CircleCI artifacts redirector for rendered HTML
22
on: [status]
33
jobs:
44
circleci_artifacts_redirector_job:
5+
if: ${{ github.repository == 'Caltech-IPAC/irsa-tutorials' }}
56
runs-on: ubuntu-latest
67
name: Run CircleCI artifacts redirector
78
steps:

0 commit comments

Comments
 (0)