Skip to content

Commit c9735bc

Browse files
committed
GH Actions: don't run cron jobs on forks
While workflows are disabled by default in forks, it is quite common for contributors to enable them to verify CI will pass before submitting a pull request. When enabling workflow runs in forks, it's "all or nothing". This means that: * All workflows which are only intended to be run on the canonical repo will also be enabled. These workflows will also often need access to repo-specific secrets and will typically fail when run from a fork. * Workflows which contain cron jobs will also be enabled. Depending on the type of account the contributor has, this can burn through their "CI minutes". This commit is based on a review of workflows containing cron jobs and disables running the jobs when a cron job is triggered in a fork.
1 parent 89b2566 commit c9735bc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions:
88

99
jobs:
1010
codeql:
11+
if: github.event.repository.fork == false
1112
permissions:
1213
actions: read # for github/codeql-action/init to get workflow details
1314
contents: read # for actions/checkout to fetch code

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions:
88

99
jobs:
1010
create:
11+
if: github.event.repository.fork == false
1112
permissions:
1213
contents: none
1314
name: Create
@@ -92,6 +93,7 @@ jobs:
9293
name: lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
9394
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
9495
update:
96+
if: github.event.repository.fork == false
9597
permissions:
9698
contents: write # for Git to git push
9799
name: Update

0 commit comments

Comments
 (0)