fix: add error handling for empty build digest in Syft SBOM scan

This commit is contained in:
GitHub Actions
2026-03-07 12:04:15 +00:00
parent c144bb2b97
commit 104f0eb6ee

View File

@@ -272,7 +272,12 @@ jobs:
tar -xzf "$TARBALL" syft
chmod +x syft
./syft "${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:nightly@${{ steps.build.outputs.digest }}" -o cyclonedx-json=sbom-nightly.json
DIGEST="${{ steps.build.outputs.digest }}"
if [[ -z "$DIGEST" ]]; then
echo "::error::Build digest is empty; cannot construct a valid image reference for Syft SBOM scan"
exit 1
fi
./syft "${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@${DIGEST}" -o cyclonedx-json=sbom-nightly.json
- name: Verify SBOM artifact
if: always()