Skip to content

Commit c9f1127

Browse files
williabyclaude
andcommitted
fix(reuse): distinguish SPDX skipped, upload-failed, and failed outcomes
The Summary step previously gated the success message on `SPDX_OUTCOME == success` alone, so an artifact upload failure was silently presented as a successful upload, and a skipped SPDX step (triggered when REUSE lint fails with `fail-on-missing: true` and the job aborts before SPDX runs) was reported as "SPDX SBOM generation failed (outcome: skipped)", sending operators to debug a step that never ran. Address both Copilot findings on PR #125: - Add `id: upload-spdx` to the Upload SPDX artifact step and thread `UPLOAD_OUTCOME` into the Summary step's env block. - Split the SPDX status line into four explicit branches: success+uploaded (happy path), success+upload-failed (artifact is missing), skipped (no SPDX failure to investigate), and any other outcome (genuine generation failure). Also document the intentional `fail-on-missing: false` behavior with an `#ASSUME` comment: SPDX still runs against a possibly non-compliant tree because the SBOM is for transparency, not for gating, and a partial inventory beats none. Refs: ByronWilliamsCPA/.github PR #125 (review comments) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent ed595aa commit c9f1127

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎.github/workflows/python-reuse.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ jobs:
8888
# entirely while preserving the security posture (no pip install on host).
8989
# #VERIFY: confirm fsfe/reuse-action@v6 `args:` input passes through to the
9090
# reuse CLI and that output files written to /github/workspace persist.
91+
# #ASSUME: when callers pass `fail-on-missing: false`, the lint step is
92+
# marked continue-on-error and SPDX still runs against a possibly non-
93+
# compliant tree (best-effort SBOM). This is intentional: the SBOM is
94+
# for transparency, not for gating, and a partial inventory beats none.
9195
- name: Generate SPDX SBOM
9296
if: ${{ inputs.generate-spdx }}
9397
id: spdx
@@ -97,6 +101,7 @@ jobs:
97101

98102
- name: Upload SPDX artifact
99103
if: ${{ inputs.generate-spdx && steps.spdx.outcome == 'success' }}
104+
id: upload-spdx
100105
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
101106
with:
102107
name: reuse-spdx-report
@@ -112,6 +117,7 @@ jobs:
112117
GENERATE_SPDX: ${{ inputs.generate-spdx }}
113118
REUSE_OUTCOME: ${{ steps.reuse.outcome }}
114119
SPDX_OUTCOME: ${{ steps.spdx.outcome }}
120+
UPLOAD_OUTCOME: ${{ steps.upload-spdx.outcome }}
115121
run: |
116122
echo "## REUSE Compliance Check" >> $GITHUB_STEP_SUMMARY
117123
echo "" >> $GITHUB_STEP_SUMMARY
@@ -146,8 +152,18 @@ jobs:
146152
147153
if [ "$GENERATE_SPDX" = "true" ]; then
148154
echo "" >> $GITHUB_STEP_SUMMARY
149-
if [ "$SPDX_OUTCOME" = "success" ]; then
155+
# SPDX status is reported as the cross product of generation outcome
156+
# and upload outcome so operators can distinguish:
157+
# - generated and uploaded (the happy path)
158+
# - generated but upload failed (the artifact is missing)
159+
# - never attempted because an earlier step failed (skipped)
160+
# - attempted and failed (the step ran and errored)
161+
if [ "$SPDX_OUTCOME" = "success" ] && [ "$UPLOAD_OUTCOME" = "success" ]; then
150162
echo "SPDX SBOM generated and uploaded as artifact." >> $GITHUB_STEP_SUMMARY
163+
elif [ "$SPDX_OUTCOME" = "success" ]; then
164+
echo "SPDX SBOM generated but artifact upload did not succeed (upload outcome: $UPLOAD_OUTCOME). See workflow logs for details." >> $GITHUB_STEP_SUMMARY
165+
elif [ "$SPDX_OUTCOME" = "skipped" ]; then
166+
echo "SPDX SBOM generation was skipped (an earlier step did not succeed). No SPDX failure to investigate." >> $GITHUB_STEP_SUMMARY
151167
else
152168
echo "SPDX SBOM generation failed (outcome: $SPDX_OUTCOME). See workflow logs for details." >> $GITHUB_STEP_SUMMARY
153169
fi

0 commit comments

Comments
 (0)