Skip to content

Commit

Permalink
Skip cache delete job for forked PRs (#1137)
Browse files Browse the repository at this point in the history
Dependabot and forked PRs don't have 'write' permission to delete the
GitHub Actions caches.

Skip this step for those kinds of PRs. It will keep the caches around
for longer than we'd like, but at least it won't balloon in size if we
skip this for all PRs.

[skip changeset]
  • Loading branch information
tombruijn authored Oct 21, 2024
1 parent 0fffae8 commit 3d25839
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ jobs:
needs:
- test_22_unit
- test_22_extra_diagnose
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork
== false
runs-on: ubuntu-latest
steps:
- name: Checkout project
Expand Down Expand Up @@ -342,6 +344,8 @@ jobs:
needs:
- test_20_unit
- test_20_extra_diagnose
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork
== false
runs-on: ubuntu-latest
steps:
- name: Checkout project
Expand Down Expand Up @@ -458,6 +462,8 @@ jobs:
needs:
- test_18_unit
- test_18_extra_diagnose
if: github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork
== false
runs-on: ubuntu-latest
steps:
- name: Checkout project
Expand Down
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ namespace :build_matrix do
unit_test_job_key,
diagnose_job_key
],
# Skip this job for dependabot and forked PRs as they do not
# have write permissions to the repository to delete caches
"if" => "github.actor != 'dependabot[bot]' && " \
"github.event.pull_request.head.repo.fork == false",
"runs-on" => "ubuntu-latest",
"steps" => [
{
Expand Down

0 comments on commit 3d25839

Please sign in to comment.