Knowledge base
GitHub CLI problems
Fix GitHub CLI issues on a Picnic machine, from gh not installed or logged out to missing scopes, failed pushes and merges GitHub refuses.
Picnic uses the GitHub CLI, gh, on each machine to open pull requests, read CI and merge. When something's wrong with it, jobs can still write code but can't push, open a pull request or merge. Start with the GitHub CLI logged in and Git identity checks in the machine's panel in the Factory tab.
"gh is not installed"
brew install gh
The Fix button runs this when Homebrew is installed. Without Homebrew, install gh from GitHub's own instructions.
"gh is not logged in"
In Terminal on that machine:
gh auth login
Choose GitHub.com, HTTPS, and log in with a browser. Each machine has its own login: logging in on your laptop doesn't help the Mac mini.
Check it worked:
gh auth status
"missing the workflow scope" (or repo)
Picnic needs the repo and workflow scopes. Without workflow, GitHub refuses any push that touches .github/workflows.
gh auth refresh -s repo,workflow
"gh took too long to answer"
The check gave up after a few seconds and will try again next minute. If it keeps happening, the machine may have network trouble reaching GitHub.
Commits fail
The Git identity check is red: git has no name or email.
git config --global user.name "Your Name"
git config --global user.email you@example.com
Push is refused
- Force-push is always refused by Picnic itself. The agent pushes normal commits instead.
- Permission denied: the GitHub account logged in on the machine can't push to that repository. Check it has write access, or that your organisation has authorised the CLI for single sign-on (
gh auth refreshthen follow the prompt). - Protected branch: jobs push to their own branch,
<first name>/<slug>-<id8>, never straight to the base branch. If branch rules block pushing to new branches, allow that pattern.
Merge is refused
| What GitHub says | What Picnic does |
|---|---|
| The branch conflicts | Resumes the agent to merge the base in and push, up to 3 times |
| A required review or other branch rule isn't met | Turns on auto-merge and waits in Needs you; GitHub merges once the rule is met. You can Merge now or Merge with admin bypass |
| Required checks failed | Resumes the agent to fix CI, up to 3 times |
| Auto-merge isn't enabled for the repository | Turn on "Allow auto-merge" in the repository's settings on GitHub, or merge from the job in Needs you |
Merge with admin bypass uses gh pr merge --squash --admin and only works if the GitHub account on that machine is an admin of the repository.
A Ship job can't check out its pull request
A Ship job given a pull request URL runs gh pr checkout <url>. Make sure the URL is the pull request's page and that the machine's GitHub login can read the repository (and the fork, for pull requests from forks).
Using a separate GitHub account for a machine
On a dedicated build machine, consider logging gh in as a machine account that can only reach the repositories that machine works on. The GitHub login decides what's actually reachable, whatever Picnic shows.
See also Set up GitHub and Waiting on CI.
