Skip to content

Commit 21e6578

Browse files
committed
chore: gate codeql and trivy steps behind ENABLE_CODE_SCANNING var
1 parent 3577671 commit 21e6578

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/codeql.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ permissions:
1818
jobs:
1919
analyze:
2020
name: Analyze (${{ matrix.language }})
21+
# Code Scanning requires GitHub Advanced Security on private repos.
22+
# To enable: make the repo public OR set repo variable
23+
# ENABLE_CODE_SCANNING=true under Settings → Secrets and variables →
24+
# Actions → Variables.
25+
if: vars.ENABLE_CODE_SCANNING == 'true'
2126
runs-on: ubuntu-latest
2227
timeout-minutes: 60
2328
permissions:

.github/workflows/docker.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ jobs:
6969
provenance: mode=max
7070
sbom: true
7171

72+
# Trivy scan + SARIF upload require Code Scanning, which needs
73+
# GitHub Advanced Security on private repos. To enable: make the
74+
# repo public OR set repo variable ENABLE_CODE_SCANNING=true
75+
# under Settings → Secrets and variables → Actions → Variables.
7276
- name: Scan image with Trivy
77+
if: vars.ENABLE_CODE_SCANNING == 'true'
7378
uses: aquasecurity/trivy-action@v0.36.0
7479
with:
7580
image-ref: ${{ env.IMAGE_PREFIX }}-${{ matrix.app }}@${{ steps.build.outputs.digest }}
@@ -80,7 +85,7 @@ jobs:
8085
exit-code: "0"
8186

8287
- name: Upload Trivy results
83-
if: always()
88+
if: always() && vars.ENABLE_CODE_SCANNING == 'true'
8489
uses: github/codeql-action/upload-sarif@v4
8590
with:
8691
sarif_file: trivy-${{ matrix.app }}.sarif

0 commit comments

Comments
 (0)