feat: bot-gh.sh preflights per-repo collaborator access - #14
Merged
Conversation
The bot must be a collaborator on EACH private repo it opens PRs in; adding it to one repo doesn't cover the rest. When it isn't, gh fails with an opaque "Could not resolve to a Repository with the name '<owner>/<repo>'" that reads like a typo, not a missing grant (hit while opening the #8 PR in a second repo). - bot-gh.sh: parse a --repo target and, if the bot can't see it, print the exact one-time grant (owner: PUT collaborators) + invite-accept (bot: PATCH repository_invitations) commands instead of letting the opaque error surface. - USAGE.md: document the per-repo "invite + accept" step in the PR-feedback loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Sub-task
Make the bot's "can't see this private repo" failure legible, and document the per-repo grant — follow-up to the bot-flow work in #7.
Problem
Opening the #8 PR (#13) in this second, private repo failed with:
The bot had only ever been added to the first repo (reDeploy). The bot must be a collaborator on every private repo it acts in — but the failure reads like a typo'd repo name, not a missing permission grant.
bot-gh.sh's header mentions the collaborator step, but nothing surfaces it at failure time.What changed
.claude/scripts/bot-gh.sh— preflight: parse a--repo OWNER/NAMEtarget; if the bot can'tgh repo viewit, print the exact one-time fix (owner:PUT .../collaborators/<bot> -f permission=push; bot:PATCH user/repository_invitations/<id>) and exit 1, instead of letting the opaque GraphQL error through. Happy path is unchanged (one cheaprepo viewwhen--repois present).docs/USAGE.md— document the per-repo "invite + accept" step in the PR-feedback-loop section (private-repo invites require the invitee to accept).Verification
bash -nclean on the script.Notes
Captured downstream in reDeploy's
docs/TEMPLATE_FEEDBACK.mdentry (D) follow-up. This is the generic-tier promotion of that learning.🤖 Generated via the multi-agent orchestrator template.