Repository navigation
fix(ci): anchor SBOM output path to GITHUB_WORKSPACE - #26
Conversation
The generate step was creating sbom-runtime.json relative to the
shell's CWD, which in a reusable workflow context may differ from
$GITHUB_WORKSPACE — the root that upload-artifact v4 resolves
against. This explains why the file existed (17768 bytes confirmed
by wc -c in run 24250664647) but the upload step still reported
"No files were found with the provided path: sbom-*.json".
Changes:
- --outfile now uses the absolute path "$GITHUB_WORKSPACE/sbom-runtime.json"
so the file is always written to the location upload-artifact expects
- Guard upgraded from -f (exists) to -s (non-empty) to also catch the
0-byte output case cyclonedx-py produces when the interpreter is missing
- Upload path changed to ${{ github.workspace }}/sbom-*.json to match
the absolute write location and remove glob-root ambiguity
- Added "Verify SBOM files before upload" step that logs pwd vs
GITHUB_WORKSPACE and lists matching files; provides diagnostic
evidence if this class of failure ever recurs
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis pull request hardens the CycloneDX SBOM generation workflow by updating artifact paths to use GitHub workspace explicitly, strengthening file validation from existence checks to non-empty file verification, adding workspace diagnostics, and verifying artifacts before upload. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
upload-artifact@v4 requires a workspace-relative path. The absolute
\${{ github.workspace }}/sbom-*.json prefix introduced in #26 was
causing "No files were found" even though the file existed at that
path (confirmed by the Verify step in run 24256290551). The action
resolves globs from \$GITHUB_WORKSPACE by default, so the bare
relative glob sbom-*.json is correct.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Summary
The
Generate runtime SBOMstep was writingsbom-runtime.jsonrelative to the shell's CWD. In a reusable workflow (workflow_call) the shell CWD and$GITHUB_WORKSPACEcan diverge, so the file landed outside the workspace root thatupload-artifactv4 resolves globs against. The upload step then reported "No files were found with the provided path: sbom-*.json" even thoughwc -cshowed the file at 17768 bytes (confirmed in run 24250664647).Changes
--outfilepath:--outfile "$GITHUB_WORKSPACE/sbom-runtime.json"anchors the output file to the same root thatupload-artifactuses, eliminating the CWD vs workspace ambiguity.-f(file exists) to-s(file non-empty) so the guard also catches the 0-byte output thatcyclonedx-pyproduces when the interpreter path is missing.path: changed fromsbom-*.jsonto${{ github.workspace }}/sbom-*.jsonso the upload glob roots from the same absolute location the file was written to.Verify SBOM files before uploadthat logspwd,$GITHUB_WORKSPACE, and afindlisting of matching files — provides immediate evidence if this class of failure recurs without needing to re-diagnose from scratch.Impact
Testing
Verify SBOM files before uploadstep shows the filescan-runtimeandlicense-compliancejobs run and complete🤖 Generated with Claude Code
Summary by CodeRabbit