Skip to content

fix(actionlint): hardcode refs/heads/main for downstream cross-repo checkout - #22

Merged
blairham merged 1 commit into
mainfrom
fix/actionlint-downstream-ref
Jun 17, 2026
Merged

fix(actionlint): hardcode refs/heads/main for downstream cross-repo checkout#22
blairham merged 1 commit into
mainfrom
fix/actionlint-downstream-ref

Conversation

@blairham

Copy link
Copy Markdown
Contributor

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`"):

  • Self-CI (`github.repository == 'pinpredict/.github'`) → use `github.ref` so PR runs see the PR's version of the action.
  • Downstream consumer → hardcode `refs/heads/main`.

Test plan

  • Self-CI on this PR passes.
  • After merge, re-run CI on trading-reports#5 and service-template#12 — validate-reusable-inputs should go green.

🤖 Generated with Claude Code

…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.
@blairham
blairham merged commit 6d7df25 into main Jun 17, 2026
2 checks passed
@blairham
blairham deleted the fix/actionlint-downstream-ref branch July 5, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant