fix(actionlint): hardcode refs/heads/main for downstream cross-repo checkout - #22
Merged
Merged
Conversation
…heckout Follow-up to #21. That PR replaced `github.workflow_sha` with `github.workflow_ref` on the assumption that `workflow_ref` exposes the reusable workflow's own ref to a downstream caller — it doesn't. In a reusable workflow context `workflow_ref` returns the caller's workflow file path, e.g. `pinpredict/trading-reports/.github/workflows/ci.yml@refs/pull/5/merge`, which then fails to resolve against pinpredict/.github with `couldn't find remote ref refs/pull/5/merge`. There is no context variable that exposes the reusable workflow's own ref to the callee. Fall back to convention: per this repo's CLAUDE.md, downstream callers always pin `@main`, so checking out main from a downstream context gives the runner the same action source it already loaded for the workflow itself. Self-CI still works: `github.repository == 'pinpredict/.github'` identifies that case and we use `github.ref` so PR-mode runs see the PR's version of the action.
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
Follow-up to #21 — that fix swapped `github.workflow_sha` for `github.workflow_ref` on a wrong assumption. In a reusable workflow context, `github.workflow_ref` returns the caller's workflow file path (e.g. `pinpredict/trading-reports/.github/workflows/ci.yml@refs/pull/5/merge`), not the reusable workflow's own ref. Result: `actions/checkout` now fails with `couldn't find remote ref refs/pull/5/merge` against pinpredict/.github.
There is no `github.*` context variable that exposes the reusable workflow's own ref to the callee. Falling back to the documented convention in this repo's CLAUDE.md ("Callers pin to `@main`"):
Test plan
🤖 Generated with Claude Code