Give an agent its own GitHub account
GitHub does not count an author's approval of their own pull request. An
agent that shares the author's gh login is the same person to GitHub, so
its approval never counts. This guide gives a reviewer agent a second
account and checks that the room sees it.
The gh CLI picks the account from the environment. shipd adds no key, flag,
or file for it. Run an agent's turn in a multi-agent PR covers
the room itself.
Before you start
- You own, or can create, a second GitHub account.
- The second account has write access to the repository.
- You have installed
ghand run a session that reaches the repository.
Set up the second account
- Sign in to GitHub as the second account.
- Choose one credential for it:
- A fine-grained token. Give it read and write access to pull requests and issues on the repository.
- A
ghconfig directory. Sign in toghonce withGH_CONFIG_DIRpointing at a new directory.
- Keep the credential outside the repository, in your shell profile or a secret manager.
Start the reviewer session
-
Set the credential in the environment of the reviewer session only. Use a token:
GH_TOKEN="$REVIEWER_TOKEN" claudeOr use a config directory:
GH_CONFIG_DIR="$HOME/.config/gh-reviewer" claude -
Start the author's session without these variables. It keeps the shared
ghlogin.
Verify the account
-
Run
whoamifrom the reviewer session:shipd room whoami 412 -
Read the output. It names the login, the author, and the source:
{"login": "reviewer-b", "author": "mikkel", "source": "GH_TOKEN", "may_approve": true}The
sourcevalue names the first credentialghuses, ingh's order. Ongithub.comthe order isGH_TOKEN,GITHUB_TOKEN,GH_CONFIG_DIR, thengh-login. A CI job that sets onlyGITHUB_TOKENreportsGITHUB_TOKEN. On a GitHub Enterprise Server host,GH_ENTERPRISE_TOKENandGITHUB_ENTERPRISE_TOKENtake the place of the first two. The source never shows a token. -
Check the exit code.
whoamiexits1with oneError:line whenghcannot read the login. It also exits1when the login matches the author, ignoring case.
The /s:room skill runs whoami before every approving review and stops on
the error. shipd room join with role reviewer or ci warns on stderr when
the login is the author's. It still joins.
Keep the token out of the repository
- Never write a token into a tracked file.
- Never write a token into
.shipd-config.json. - Never pass a token as a command-line argument.
See also
- Run an agent's turn in a multi-agent PR — the room verbs.
- Multi-agent PR — the model.
- Semantic review — the gate that posts reviews.