Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
sbom: true
# The tags generated in the metadata step include tags for both Docker Hub and GHCR image names,
# allowing the build and push action to build and push images to both registries.
tags: ${{ steps.meta.outputs.tags }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/sbom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
on:
workflow_call:

permissions:
contents: read

jobs:
sbom:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
path: head
persist-credentials: false

- name: Generate SBOM
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
with:
path: head
format: cyclonedx-json
output-file: sbom.cdx.json
artifact-name: sbom.cdx.json
upload-release-assets: false

- name: Checkout base
if: github.event_name == 'pull_request'
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.base.sha }}
path: base
persist-credentials: false

- name: Generate base SBOM
if: github.event_name == 'pull_request'
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
with:
path: base
format: cyclonedx-json
output-file: sbom-base.cdx.json
upload-artifact: false
upload-release-assets: false

- name: Compare SBOMs
if: github.event_name == 'pull_request'
shell: bash
run: |
purls() { jq -r '.components[]?.purl // empty' "$1" | sort -u; }
purls sbom-base.cdx.json > "$RUNNER_TEMP/base.txt"
purls sbom.cdx.json > "$RUNNER_TEMP/head.txt"
comm -3 "$RUNNER_TEMP/base.txt" "$RUNNER_TEMP/head.txt" | sed \
-e 's/^\t/::warning title=SBOM changed::Added /;t' \
-e 's/^/::warning title=SBOM changed::Removed /'
Loading