Skip to content

Commit bc635e0

Browse files
committed
fix: fix Snyk Security workflow - move SNYK_TOKEN to job-level env, enable graceful failures, remove Docker steps
1 parent f239ba1 commit bc635e0

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

.github/workflows/snyk-security.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,43 +34,29 @@ jobs:
3434
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
3535
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
3636
runs-on: ubuntu-latest
37+
env:
38+
# This is where you will need to introduce the Snyk API token created with your Snyk account
39+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
3740
steps:
3841
- uses: actions/checkout@v4
3942
- name: Set up Snyk CLI to check for security issues
4043
# Snyk can be used to break the build when it detects security issues.
4144
# In this case we want to upload the SAST issues to GitHub Code Scanning
4245
uses: snyk/actions/setup@806182742461562b67788a64410098c9d9b96adb
4346

44-
# For Snyk Open Source you must first set up the development environment for your application's dependencies
45-
# For example for Node
46-
#- uses: actions/setup-node@v4
47-
# with:
48-
# node-version: 20
49-
50-
env:
51-
# This is where you will need to introduce the Snyk API token created with your Snyk account
52-
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
53-
5447
# Runs Snyk Code (SAST) analysis and uploads result into GitHub.
5548
# Use || true to not fail the pipeline
5649
- name: Snyk Code test
57-
run: snyk code test --sarif > snyk-code.sarif # || true
50+
run: snyk code test --sarif > snyk-code.sarif || true
5851

5952
# Runs Snyk Open Source (SCA) analysis and uploads result to Snyk.
6053
- name: Snyk Open Source monitor
61-
run: snyk monitor --all-projects
54+
run: snyk monitor --all-projects || true
6255

6356
# Runs Snyk Infrastructure as Code (IaC) analysis and uploads result to Snyk.
6457
# Use || true to not fail the pipeline.
6558
- name: Snyk IaC test and report
66-
run: snyk iac test --report # || true
67-
68-
# Build the docker image for testing
69-
- name: Build a Docker image
70-
run: docker build -t your/image-to-test .
71-
# Runs Snyk Container (Container and SCA) analysis and uploads result to Snyk.
72-
- name: Snyk Container monitor
73-
run: snyk container monitor your/image-to-test --file=Dockerfile
59+
run: snyk iac test --report || true
7460

7561
# Push the Snyk Code results into GitHub Code Scanning tab
7662
- name: Upload result to GitHub Code Scanning

0 commit comments

Comments
 (0)