Fix the code-contribution fork fallback (v0.5.1) - #113
Merged
Merged
Conversation
`gh repo fork <repo> --remote --remote-name contribfork` is rejected by gh: "the --remote flag is unsupported when a repository argument is provided". Runners hit this whenever the direct push to the contrib repo was refused, so the PR never opened and the contribution degraded to inline code only. Fork without touching remotes and wire the fork up with plain git instead. Verified against real gh 2.88.1 + GitHub: direct push 403 -> gh repo fork --clone=false -> git remote add contribfork -> push to the fork, all clean. Also stop swallowing the direct-push error. Previously only the fork failure surfaced, hiding why the push was refused in the first place; the runner now reports both causes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WoAJRWLbAW5pakUUzEzcjV
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 broke
A runner hit this mid-task:
publishCodeContributionfell back togh repo fork <repo> --remote --remote-name contribforkwhenever the direct push to the contrib repo was refused. gh rejects
--remoteoutright when arepository argument is present, so the fork step exited 1, the PR never opened, and the
contribution degraded to inline code only.
No volunteer work was lost — the inline copy is persisted server-side either way — but the
artifact_uri never became a PR URL.
The fix
Fork without touching remotes, then wire the fork up with plain git:
The
gh api usercall moved ahead of the push, since the login now builds the remote URL.Also: the direct-push error is no longer swallowed. Previously only the fork failure surfaced,
hiding why the push was refused. The runner now reports both causes:
direct push refused (…); fork fallback failed (…).Verification
Against real gh 2.88.1 and real GitHub, using an upstream without push rights that was already
forked (so the fork step added nothing new):
git push -u origin→remote: Permission to rkbarney/justrss.git denied to Barneyjm(403), sothe fallback genuinely triggers.
gh repo fork rkbarney/justrss --clone=false→Barneyjm/justrss already exists, exit 0.git remote add contribfork→git push -u contribfork→* [new branch].headresolves toBarneyjm:contrib/…, exactly whatgh pr create --headwants. Onlygh pr createwas skipped, since it would open a PR on a third party's repo. Rehearsal branchdeleted afterward.
Notes
0.4.0—never bumped for 0.5.0 — so that drift is corrected here too.
npx givework start, so this only reaches volunteers on release.🤖 Generated with Claude Code
https://claude.ai/code/session_01WoAJRWLbAW5pakUUzEzcjV