Configure an R package repository to generate SBOM artifacts in CI
use_sbom.RdWrites a GitHub Actions workflow (.github/workflows/sbom-r.yml) that generates
an SBOM using Anchore's SBOM Action (Syft-based), and writes additional
environment metadata (and a copy of renv.lock) into artifacts/sbom/.
Details
This function is intended to be run once during initial repository setup in
an interactive session (similar to the usethis pattern).
What this function does:
Validates that
dest_diris an R package root (hasDESCRIPTION).Creates
.github/workflows/if missing.Writes
.github/workflows/sbom-r.yml(fails if it exists andoverwrite = FALSE).Ensures ignore rules:
Adds
/artifacts/to.gitignoreAdds
^artifacts$to.Rbuildignore
Next steps after running:
Ensure
reproducibleaiis included in the project'srenv.lock(install it and runrenv::snapshot()if needed).Commit changes and open a PR to verify the workflow produces an SBOM bundle.