Skip to content

Commit 51b0f5d

Browse files
committed
Fix security scanning to update GitHub Security alerts
Changes to ensure fresh security alerts on GitHub: - Remove path filtering to run security scans on all pushes/PRs - Add fetch-depth: 0 for complete repository scanning - Add exit-code: 0 to prevent workflow failures from blocking alerts - Remove redundant GITHUB_TOKEN env (inherited from permissions) - Simplify workflow triggers for more frequent security updates This ensures the Security tab shows current scan results instead of referencing outdated workflow configurations. Signed-off-by: Ihor Dvoretskyi <[email protected]>
1 parent 47c1b34 commit 51b0f5d

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

.github/workflows/security.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@ name: Security Analysis
22

33
on:
44
schedule:
5-
# Run security scans daily at 2 AM UTC
65
- cron: '0 2 * * *'
76
push:
87
branches: [ main ]
9-
paths:
10-
- '.devcontainer/**'
11-
- '.github/workflows/security.yml'
128
pull_request:
139
branches: [ main ]
14-
paths:
15-
- '.devcontainer/**'
16-
- '.github/workflows/security.yml'
17-
workflow_dispatch: # Allow manual trigger
10+
workflow_dispatch:
1811

1912
permissions:
2013
contents: read
@@ -27,6 +20,8 @@ jobs:
2720
steps:
2821
- name: Checkout
2922
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
3025

3126
- name: Build Docker image for scanning
3227
run: |
@@ -41,15 +36,14 @@ jobs:
4136
format: 'sarif'
4237
output: 'trivy-results.sarif'
4338
severity: 'CRITICAL,HIGH'
39+
exit-code: '0'
4440

4541
- name: Upload Trivy scan results to GitHub Security tab
4642
uses: github/codeql-action/upload-sarif@v3
4743
if: always()
4844
with:
4945
sarif_file: 'trivy-results.sarif'
5046
category: 'trivy-image-scan'
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5347

5448
- name: Generate SBOM
5549
uses: anchore/sbom-action@v0
@@ -73,12 +67,11 @@ jobs:
7367
format: 'sarif'
7468
output: 'trivy-fs-results.sarif'
7569
severity: 'CRITICAL,HIGH'
70+
exit-code: '0'
7671

7772
- name: Upload filesystem scan results
7873
uses: github/codeql-action/upload-sarif@v3
7974
if: always()
8075
with:
8176
sarif_file: 'trivy-fs-results.sarif'
82-
category: 'trivy-filesystem-scan'
83-
env:
84-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
category: 'trivy-filesystem-scan'

0 commit comments

Comments
 (0)