From 81a73ab9df2293a95ecba97f131fed846d5129f2 Mon Sep 17 00:00:00 2001 From: Tom de Bruijn Date: Mon, 21 Oct 2024 09:28:15 +0200 Subject: [PATCH] Skip cache delete job for forked PRs 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] --- .github/workflows/ci.yml | 6 ++++++ Rakefile | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b17295ae..346e92ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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 diff --git a/Rakefile b/Rakefile index cdb0e43f..d5953245 100644 --- a/Rakefile +++ b/Rakefile @@ -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" => [ {