Skip to content

Commit

Permalink
ci: add IS_FORK to skip some jobs on PRs from forked projects
Browse files Browse the repository at this point in the history
Signed-off-by: PINCHON Benjamin <benjamin.pinchon@orange.com>
  • Loading branch information
mydoomfr committed Sep 9, 2024
1 parent b3e1d0f commit 4023a92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4023a92

Please sign in to comment.