Repository navigation
fix(action): Resolve any branch in a private repository - #29
Merged
Merged
Conversation
The workflows check out with persist-credentials: false, so a later git fetch has no credentials. A public repository answers it anyway and a private one refuses it. resolve_ref.sh fetched any branch other than the one checked out by name, so in a private repository that branch could not be resolved. A full checkout already has every branch as origin/<name>, so the script now looks there before fetching. A pull request number and a commit on no branch or tag still need a fetch, and still fail in a private repository. The resolve-ref README says which refs work there, and the quickstart says to keep to those for now. Checked by pointing a clone with the checkout's refspecs at a private repository's URL. Before this, another branch failed with "could not read Username". Now it resolves, and a pull request number still fails the same way. The new tests do the same against an origin that cannot be reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ccJFsmZ4jAKYmFNgNBh9u
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.
What changed
The workflows check out with
persist-credentials: false, so a latergit fetchhas no credentials. A public repository answers the fetch anyway. A private one refuses it.bin/resolve_ref.shfetched any branch other than the one checked out, by name. So in a private repository, naming another branch as the candidate or baseline failed withcould not read Username for 'https://github.com'.A full checkout already has every branch as
origin/<name>. The script now looks there before it fetches.In a private repository these still need a fetch, and still fail:
refs/pull/, which a checkout does not fetch)Fixing those means handing the token to that one fetch. It would have to stay out of the step that runs the caller's build. That changes how the workflows handle credentials, so it is not part of this PR.
Docs:
actions/resolve-ref/README.mdhas a section saying which refs resolve in a private repository.How it was checked
originat a private repository's URL.could not read Username. After it, the branch resolves.tests/test_resolve.pydo the same against anoriginthat cannot be reached:python3 -m pytest testspasses (424 tests), andpre-commit run --all-filesis clean.The workflows call this script through the pinned
resolve-refaction. So callers get the fix with the next release, and no workflow change is needed.🤖 Generated with Claude Code
https://claude.ai/code/session_018ccJFsmZ4jAKYmFNgNBh9u
Generated by Claude Code