From 4023a9237d5dad72a79c29cc4db626b36fc26d60 Mon Sep 17 00:00:00 2001 From: PINCHON Benjamin Date: Mon, 9 Sep 2024 15:14:34 +0200 Subject: [PATCH] ci: add IS_FORK to skip some jobs on PRs from forked projects Signed-off-by: PINCHON Benjamin --- .github/workflows/build.yml | 4 ++++ .github/workflows/ci.yml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79771fe..9d207f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,9 +15,13 @@ on: GHCR_TOKEN: required: true +env: + IS_FORK: ${{ secrets.GHCR_USERNAME == '' && 'true' || 'false' }} + jobs: build-and-push-image: runs-on: ubuntu-latest + if: env.IS_FORK == 'false' permissions: contents: read diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc5da0c..af3bfbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: env: GOLANGCI_VERSION: 'v1.60.1' KUBERNETES_VERSION: '1.29.x' + IS_FORK: ${{ secrets.GHCR_USERNAME == '' && 'true' || 'false' }} permissions: contents: read @@ -123,7 +124,7 @@ jobs: name: SonarQube Trigger runs-on: ubuntu-latest needs: detect-noop - if: needs.detect-noop.outputs.noop != 'true' + if: needs.detect-noop.outputs.noop != 'true' && env.IS_FORK == 'false' continue-on-error: true steps: