Skip to content

feat: bot-gh.sh preflights per-repo collaborator access - #14

Merged
robercano merged 1 commit into
mainfrom
feat/bot-gh-preflight
Jun 20, 2026
Merged

feat: bot-gh.sh preflights per-repo collaborator access#14
robercano merged 1 commit into
mainfrom
feat/bot-gh-preflight

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

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:

GraphQL: Could not resolve to a Repository with the name 'robercano/ai-project-orchestrator'.

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/NAME target; if the bot can't gh repo view it, 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 cheap repo view when --repo is 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 -n clean on the script.
  • Smoke-tested: friendly error fires on an inaccessible repo; pass-through on a repo the bot can see.

Notes

Captured downstream in reDeploy's docs/TEMPLATE_FEEDBACK.md entry (D) follow-up. This is the generic-tier promotion of that learning.

🤖 Generated via the multi-agent orchestrator template.

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>

@robercano robercano left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@robercano
robercano merged commit e3a3772 into main Jun 20, 2026
@robercano
robercano deleted the feat/bot-gh-preflight branch June 20, 2026 10:33
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.

2 participants