Skip to content

Commit 8818fa9

Browse files
committed
ci: add gh workflows to generate sbom
Signed-off-by: Sonu Saha <[email protected]>
1 parent 5747f3b commit 8818fa9

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Diff for: .github/workflows/sbom.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Generate GitHub SBOM and Upload as Artifact
2+
3+
# NOTE: We would probably want to run this workflow on every push to main and not on pull requests
4+
5+
# on:
6+
# push:
7+
# branches:
8+
# - main
9+
10+
on:
11+
pull_request:
12+
branches:
13+
- main
14+
15+
jobs:
16+
generate-sbom:
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: read
21+
security-events: read
22+
23+
steps:
24+
# Step 1: Checkout the repository
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
28+
# Step 2: Generate GitHub SBOM (Dependency Snapshot)
29+
- name: Generate GitHub SBOM
30+
id: sbom
31+
uses: actions/dependency-review-action@v3
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
output: sbom.json # Save as JSON file
35+
36+
# Step 3: Convert SBOM to CSV
37+
- name: Convert SBOM to CSV
38+
run: |
39+
jq -r '.dependencies[] | [.package.name, .package.version, .relationship] | @csv' sbom.json > sbom.csv
40+
41+
# Step 4: Upload SBOM as GitHub Artifact
42+
- name: Upload SBOM and CSV as Artifact
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: sbom-files
46+
path: |
47+
sbom.json
48+
sbom.csv

0 commit comments

Comments
 (0)