Connect a repository
Anvil works on repositories on GitHub and on repositories hosted on Anvil itself. Connecting one takes a single step.
On GitHub: install the app #
- In Anvil, open Settings → Repositories and click Install on GitHub (or open the install link your invite email points to).
- Pick your account or organisation, then All repositories or the ones you choose. Organisation owners approve installs on organisations.
- That's it. The next pull request you open gets reviewed, on GitHub, and appears in Anvil.
The app reads code, writes pull request reviews, comments and commit statuses, and reads Actions runs (for CI insight and failure diagnosis). It pushes code only when someone with write access asks for a change (@anvil fix and the other code-changing commands), and never to your default branch. Remove it any time from GitHub's Settings → Applications.
Hosted on Anvil: turn reviews on #
- Create a repository under Code → New repository (see Hosted repositories) and leave Review pull requests on. For a repository you already have, open Settings → Repositories and click Turn on next to it.
- That's it. The next pull request you open gets reviewed.
Turning reviews on gives the anvil bot access to the repository: it reads the code, posts reviews and comments, and sets the Anvil commit status, which you can require in branch protection. It pushes only the changes people ask for with @anvil fix and the other code-changing commands, never on its own unless agents.autofix_ci is on, and never to the default branch. To have it post patches instead of pushing, set agents.push: off.
You need admin rights on a repository to turn reviews on or off. To stop reviews without turning them off, set enabled: false in .anvil.yaml, or comment @anvil pause on a single PR. There's no webhook to set up.
Bring a GitHub repository #
To review a GitHub repository's pull requests on GitHub, install the app (above). To move the code onto Anvil instead, mirror it:
- Open Settings → Repositories → Mirror a repository into Anvil.
- Paste the clone URL. For a private repository, add a GitHub token that can read its contents.
- Pick a name and click Create mirror. Anvil copies the repository under your account, turns reviews on, and pulls new commits every 10 minutes.
A mirror is a read-only copy: pull requests opened on GitHub aren't copied, and it can't receive pushes. To work on Anvil, create a repository and push the project to it instead (see Clone and push); you can keep GitHub current with a second remote.
What happens on the first pull request #
- Anvil gets a
pull_requestevent, queues a review and waits 15 seconds, so a burst of pushes becomes one review. - It reads
.anvil.yaml(or.anvil.yml, or.gitea/anvil.yaml) from the PR's base branch, so a PR can't change the rules of its own review. Without one, the defaults apply. - It checks the auto review rules: drafts, titles containing "wip" or "do not review", ignored authors and base branches are skipped. When the first review is skipped, the walkthrough comment says why and how to run it anyway (
@anvil review). - It sets the
Anvilstatus to pending, posts a placeholder walkthrough, clones the repository, reviews, and then posts the findings, the walkthrough and the final status. - The repository and pull request appear in Anvil's dashboard under Pull requests, and its CI runs under Run history once a workflow runs.