Add --resolve-refs flag#7
Merged
TooFastTooCurious merged 1 commit intomainfrom Apr 15, 2026
Merged
Conversation
Resolve tag and branch refs to the commit SHA they currently point to at BOM-generation time, stored in ActionRef.ResolvedSHA alongside the original ref. Turns a mutable-tag BOM into a stable evidentiary record. Covers tag and branch refs. SHA-pinned, Docker, and local refs are skipped. The original ref is preserved so contributor intent stays visible. Shares the GitHub API auth and rate-limit pattern with --verify-shas. When both flags are set, resolution runs first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #5.
New opt-in flag
--resolve-refsthat calls the GitHub commits API for each tag- or branch-pinned action reference and records the current commit SHA inActionRef.ResolvedSHAalongside the original ref. Turns a mutable-tag BOM into a stable evidentiary record, which matters for audit, compliance, or forensic use cases where "what actually ran" needs to be recoverable months later.Ben proposed this in #5 and agreed on covering both tags and branches (someone pinning to
mainhas still opted into stability, they just won't have used this flag). Name changed from--resolve-tagsto--resolve-refsto match the broader coverage.The problem
The original
ref: "v4"is preserved so the contributor's stated intent stays visible in the BOM.resolved_shais additive metadata, not a replacement.What gets resolved
v4)main)./foo)Dedup is keyed on
owner/repo@refso two actions referencing the same tag in different subdirectories collapse into a single API call.Rate limiting
Each unique tag or branch ref costs one authenticated API call (5000/hour with token, 60/hour anonymous). Same pattern as
--verify-shas:--resolve-refs --offlinefails fast at flag validation--resolve-refswith no token emits a startup rate-limit warning via the collector so--fail-on-warningscatches itNetwork or 5xx errors emit a
ref-resolvecategory warning for that specific ref without populatingresolved_sha. 404 (ref not found) does the same.Interaction with
--verify-shasOrthogonal.
--verify-shaswalks SHA-pinned refs and checks reachability.--resolve-refswalks tag and branch refs and populatesresolved_sha. When both flags are set, ref resolution runs first (gives the fuller BOM), then SHA verification runs over the genuinely SHA-pinned refs.No conflict, no double-counting, no new semantics.
Output
ActionRef.ResolvedSHAwas already a field on the struct (placeholder, never populated). The JSON formatter surfaces it automatically when set:{ "uses": "actions/checkout@v4", "ref": "v4", "ref_type": "tag", "resolved_sha": "34e114876b0b11c390a56381ad16ebd13914f8d5" }No output-format code needed to change. CycloneDX and SPDX formatters could surface the resolved SHA as a property or version in a follow-up.
Files changed
Test plan
Automated (all passing):
go test ./...go vet ./...go build ./...Unit tests cover:
ref-resolvewarning, leaves ResolvedSHA emptyref-resolvewarningManual smoke:
abom --helplists--resolve-refsabom scan . --resolve-refs --offlineerrors with a clear "remove --offline" message--resolve-refsemits the rate-limit startup warningLive integration against api.github.com was not included for the same reason as the verify-shas PR (flaky under anonymous rate limits in the harness).