Uh oh!
There was an error while loading. Please reload this page.
Resolve --gh-aw-ref branch/tag to commit SHA at compile time - #38689
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request makes gh aw compile --gh-aw-ref <BRANCH|TAG> resolve the provided ref to an immutable 40-character commit SHA at compile time, preventing compiled .lock.yml files from silently drifting as branches move or tags are recreated.
Changes:
- Added
workflow.ResolveGhAwRef(ctx, ref)to resolve branch/tag refs to full commit SHAs (skipping resolution when already given a full SHA). - Updated the
compilecommand’s--gh-aw-refhandling to resolve early and fail fast on resolution errors. - Updated
DEVGUIDE.mdand CLI flag help text to document SHA-resolution behavior.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/action_resolver.go | Adds ResolveGhAwRef to resolve github/gh-aw refs to full SHAs via gh api. |
cmd/gh-aw/main.go | Uses ResolveGhAwRef when --gh-aw-ref is provided; updates help text accordingly. |
DEVGUIDE.md | Documents that branch/tag refs are resolved to SHAs at compile time for immutability. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@copilot review all comments and address unresolved review feedback. Please refresh the branch and rerun checks once that is done.
|
@copilot review all comments and address unresolved review feedback.
|
Please rerun checks after the branch refresh and summarize any remaining blockers.
|
``
|
``
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
✅ smoke-ci: safeoutputs CLI comment + comment-memory run (27393440896)
|
…AwRef Add missing Action Pinning entries introduced by #38689: - NewActionResolver constructor - ActionResolver.ResolveSHA method - ResolveGhAwRef standalone function Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Documents two CLI gaps surfaced by daily activity: - Adds `--gh-aw-ref` to the `compile` options list and a short description explaining branch/tag SHA resolution (PR #38689). - Corrects the `gh aw mcp add` inline comment to reflect that the no-argument form lists registry servers, and adds a separate line showing the add form (#38386 item 3). Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
PR #38689 — Resolve
--gh-aw-refbranch/tag to commit SHA at compile timeSummary
Ensures that when a branch or tag name is supplied via
--gh-aw-ref, it is resolved to a full 40-character immutable commit SHA at compile time (before the value is used asactionTag). Previously, a mutable ref such as a branch name could be embedded into the compiled workflow, making the resulting artifact non-deterministic. After this change the compiled output always pins to an exact SHA.What changed
cmd/gh-aw/main.goworkflow.ResolveGhAwRefin thecompilecommand handler; resolves the--gh-aw-refvalue to a full SHA before it is stored asactionTag. Updates the flag's help text to reflect SHA resolution.pkg/workflow/action_resolver.goResolveGhAwRef: queries the GitHub API for the given ref in thegithub/gh-awrepository and returns its full SHA. Short-circuits if the input is already a valid 40-char SHA (no API call needed).DEVGUIDE.md<REF>to<SHA>.Motivation
Embedding a branch name (e.g.
main) or a tag name into a compiled workflow means the reference can move between compile time and execution time, breaking reproducibility and auditability. Resolving to a SHA at compile time:Behaviour details
ResolveGhAwRefchecks whether the input is already a 40-hex-char SHA; if so it returns it immediately without making an API call.github/gh-awrepository to resolve it.Risk & impact
compileinvocation when--gh-aw-refis a non-SHA ref (zero calls if already a SHA)gh aw compileonlypkg/workflow/action_resolver.go(new exported function);cmd/gh-aw/main.gocompile handlerCommits
f1f2cccda85a21806170b0f6124