From 4dbe1dce5ed24fa040f22830fe015fac2ee5712b Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sun, 3 Nov 2024 12:50:27 +0100 Subject: [PATCH] Use cache in readonly mode for PRs in forked repos --- .github/workflows/main.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dae3f37..f56e3c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,6 +63,9 @@ jobs: # if not a pull request and a push to master, also push "latest" tag # try to cache from previous build and then build component using build script run: | - export PUSH=true + export PUSH=true CACHE=true + # Only push latest when pushing to master if [ "$GITHUB_EVENT_NAME" != "pull_request" ] && [ "$GITHUB_REF" == "refs/heads/master" ]; then export PUSH=latest; fi - CACHE=true ./build ${{ matrix.component }} + # PRs from forked repositories can't have package write permissions, so use cache in readonly mode in those cases. + if [ '${{ github.event.pull_request.head.repo.full_name }}' != "dbvideostriketeam/wubloader" ]; then export CACHE=readonly; fi + ./build ${{ matrix.component }}