Skip to content

Commit 33f887c

Browse files
committed
fix(ci): skip security scan on forks to avoid SARIF upload permission error
The Security Scan workflow was failing on fork PRs because the workflow does not have permission to upload SARIF files to the GitHub Security tab when running from a fork. This change adds '!github.repository.fork' checks to all steps to prevent the workflow from running on fork repositories. This fix should be applied to the main repository so that all forks inherit the correct configuration. Fixes mudler#10322, mudler#10318, mudler#10320, mudler#10321
1 parent 00027e0 commit 33f887c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/secscan.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ jobs:
1515
steps:
1616
- name: Checkout Source
1717
uses: actions/checkout@v6
18-
if: ${{ github.actor != 'dependabot[bot]' }}
18+
if: ${{ !github.repository.fork && github.actor != 'dependabot[bot]' }}
1919
- name: Run Gosec Security Scanner
20-
if: ${{ github.actor != 'dependabot[bot]' }}
20+
if: ${{ !github.repository.fork && github.actor != 'dependabot[bot]' }}
2121
uses: securego/gosec@v2.27.1
2222
with:
2323
# we let the report trigger content trigger a failure using the GitHub Security features.
2424
args: '-no-fail -fmt sarif -out results.sarif ./...'
2525
- name: Upload SARIF file
26-
if: ${{ github.actor != 'dependabot[bot]' }}
26+
if: ${{ !github.repository.fork && github.actor != 'dependabot[bot]' }}
2727
uses: github/codeql-action/upload-sarif@v4
2828
with:
2929
# Path to SARIF file relative to the root of the repository

0 commit comments

Comments
 (0)