Skip to content

Commit cbb8679

Browse files
authored
Add a workflow for the ScanCode.io to ORT integration (#1866)
Signed-off-by: tdruez <[email protected]>
1 parent 30c23a3 commit cbb8679

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Generate ORT package-file.yml with ScanCode.io and load into ORT
2+
3+
# This workflow:
4+
# 1. Analyze a Docker image using ScanCode.io
5+
# 2. Generates an ORT `package-file.yml` from the SCIO project results
6+
# 3. Generates an ORT `analyzer-result.yml` using create-analyzer-result-from-package-list
7+
# 4. Run the ORT report on `analyzer-result.yml` to generate a CycloneDX and SpdxDocument
8+
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
# Run once a week (every 7 days) at 00:00 UTC on Sunday
13+
- cron: "0 0 * * 0"
14+
15+
permissions:
16+
contents: read
17+
18+
env:
19+
SCIO_IMAGE_INPUT: "docker://osadl/alpine-docker-base-image:v3.22-latest"
20+
ORT_VERSION: "68.1.0"
21+
22+
jobs:
23+
generate-and-load-sbom:
24+
runs-on: ubuntu-24.04
25+
steps:
26+
- name: Analyze Docker image with ScanCode.io
27+
uses: aboutcode-org/scancode-action@main
28+
with:
29+
pipelines: "analyze_docker_image"
30+
input-urls:
31+
"${{ env.SCIO_IMAGE_INPUT }}"
32+
scancodeio-repo-branch: "main"
33+
output-formats: "ort-package-list spdx:2.2 cyclonedx json xlsx"
34+
35+
- name: Copy package-list.yml to workspace root
36+
run: |
37+
FILE=$(ls ${{ env.PROJECT_WORK_DIRECTORY }}/output/*.package-list.yml | head -n 1)
38+
sudo mkdir -p ${GITHUB_WORKSPACE}/ort-data/
39+
sudo cp "$FILE" "${GITHUB_WORKSPACE}/ort-data/package-list.yml"
40+
sudo chmod -R 777 ${GITHUB_WORKSPACE}/ort-data/
41+
ls -lh "${GITHUB_WORKSPACE}/ort-data/"
42+
43+
- name: Generates an ORT analyzer-result.yml file
44+
run: |
45+
docker run --rm -v ${GITHUB_WORKSPACE}/ort-data:/data \
46+
--entrypoint /opt/ort/bin/orth \
47+
ghcr.io/oss-review-toolkit/ort:${{ env.ORT_VERSION }} \
48+
create-analyzer-result-from-package-list \
49+
--package-list-file /data/package-list.yml \
50+
--ort-file /data/analyzer-result.yml
51+
52+
- name: Report as CycloneDX and SPDX using the analyzer-result.yml file
53+
run: |
54+
docker run --rm -v ${GITHUB_WORKSPACE}/ort-data:/data \
55+
ghcr.io/oss-review-toolkit/ort:${{ env.ORT_VERSION }} \
56+
report \
57+
--ort-file /data/analyzer-result.yml \
58+
--output-dir /data/results/ \
59+
--report-formats CycloneDX,SpdxDocument
60+
61+
- name: Upload SBOMs as GitHub Artifact
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: ort-report
65+
path: "${GITHUB_WORKSPACE}/ort-data/results"
66+
retention-days: 20

0 commit comments

Comments
 (0)