Skip to content

Commit 752e124

Browse files
author
hbird-pre-alpha-test-v3[bot]
authored
Update code scan workflow
1 parent 1c7e3c8 commit 752e124

1 file changed

Lines changed: 66 additions & 3 deletions

File tree

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,70 @@
11
name: DigiCert Code Scan
2-
on: workflow_dispatch
2+
3+
on:
4+
workflow_dispatch:
5+
36
jobs:
4-
noop:
7+
analyze:
8+
name: Analyze (${{ matrix.language }})
9+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
10+
11+
permissions:
12+
# required for all workflows
13+
security-events: write
14+
15+
# required to fetch internal or private CodeQL packs
16+
packages: read
17+
18+
# only required for workflows in private repositories
19+
actions: read
20+
contents: read
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
# - This will be replaced with the generated language and build mode content on runtime
27+
- language: Java
28+
build-mode: none
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
# Initializes the CodeQL tools for scanning.
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v3
36+
with:
37+
languages: ${{ matrix.language }}
38+
build-mode: ${{ matrix.build-mode }}
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@v3
42+
with:
43+
category: '/language:${{matrix.language}}'
44+
sbom:
45+
name: Generate SBOM
546
runs-on: ubuntu-latest
647
steps:
7-
- run: echo "This is just a placeholder"
48+
- name: Generate SBOM with cdxgen
49+
run: |
50+
docker run --rm -v "$(pwd)":/app -t ghcr.io/cyclonedx/cdxgen-java11:v11 -r . -o ./sbom-cdxgen.cyclonedx.json
51+
52+
- name: Install CycloneDX CLI for conversion
53+
run: |
54+
wget https://github.com/CycloneDX/cyclonedx-cli/releases/latest/download/cyclonedx-linux-x64 -O cyclonedx
55+
chmod +x cyclonedx
56+
sudo mv cyclonedx /usr/local/bin/cyclonedx
57+
58+
- name: Convert cyclonedx bom to to SPDX spec
59+
run: |
60+
if [ -f sbom-cdxgen.cyclonedx.json ]; then
61+
cyclonedx convert --input-file sbom-cdxgen.cyclonedx.json --output-file sbom-cdxgen.spdx.json --output-format spdxjson
62+
fi
63+
64+
- name: Upload SBOM by cdxgen as Artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: sbom-cdxgen
68+
path: |
69+
sbom-cdxgen.cyclonedx.json
70+
sbom-cdxgen.spdx.json

0 commit comments

Comments
 (0)