From 8218c64566ba5c9863105b042733d36689729334 Mon Sep 17 00:00:00 2001 From: Andre Nogueira Date: Fri, 27 Nov 2026 00:33:16 +0000 Subject: [PATCH] fix(ci): guard GHAS-only steps on private repositories Skip dependency-review and Code Scanning SARIF upload by default when github.event.repository.private is true (where GitHub requires paid GitHub Advanced Security), while still running Trivy vulnerability scanning and failing CI on CRITICAL/HIGH findings across both private and public repos. Signed-off-by: Andre Nogueira --- .github/workflows/dependency-review.yml | 6 ++++++ .github/workflows/go-ci.yml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 7a4bdd6..363986c 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -13,6 +13,11 @@ on: required: false type: string default: "MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD, MPL-2.0, Unlicense, CC0-1.0, Zlib, BlueOak-1.0.0, PSF-2.0, LicenseRef-scancode-google-patent-license-golang" + run-on-private: + description: "Run on private repositories (requires paid GitHub Advanced Security)" + required: false + type: boolean + default: false permissions: contents: read @@ -21,6 +26,7 @@ permissions: jobs: dependency-review: name: Dependency Review + if: github.event.repository.private == false || inputs.run-on-private runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml index d5a59be..260a770 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/go-ci.yml @@ -155,7 +155,7 @@ jobs: exit-code: "0" - name: Upload Trivy results to GitHub Security tab - if: always() + if: always() && github.event.repository.private == false uses: github/codeql-action/upload-sarif@v4 with: sarif_file: "trivy-results.sarif"