Approve by rule
Peeps never approves its own pull request. When a fix matches your rule, Peeps does two things:- It adds the
peeps:auto-approvelabel to the pull request. - It turns on GitHub auto-merge with your chosen merge method.
Which fixes match
A fix is approved by your rule only when all of these hold:- It changes how the test finds or waits for things, such as a locator, a wait or a page object. Peeps’ review classes every fix. A fix that changes what the test checks, such as an assertion or the test’s data, always waits for a person.
- Its
Peeps / fix verificationcheck passed the first time on the pull request’s latest commit. A pass after a retry doesn’t count, and neither does a run whose retries your Peeps action doesn’t report, so use the latest version of the action. - It isn’t a draft. If Healed fixes arrive as is Draft pull request, no fix matches.
- It merges into a branch you chose. By default that’s the headline branch. You can name other branches, and you can include fixes into an open pull request’s branch (see Fix a test on a pull request).
- Every file it changes is under the project’s test root. This is on by default, and you can turn it off. There’s no limit on how many files a fix changes.
Peeps / fix verification check. If someone pushes to the fix’s branch after that, the next verification decides again.
Set it up
1
Turn on the rule
Open the project’s Repository settings page. Under Approve and merge Peeps fixes, check Approve and merge a Peeps fix when it matches this rule. Choose the branches, the merge method and the other options, then click Save rule. It takes Contributor or above.
2
Add the approval workflow
Click Add the approval workflow. GitHub opens
.github/workflows/peeps-auto-approve.yml on your headline branch with the workflow already written. Commit it there.3
Change two repository settings
In your repository’s Settings > General, turn on Allow auto-merge. In Settings > Actions > General, turn on Allow GitHub Actions to create and approve pull requests.
4
Require the fix verification check
In the ruleset for your headline branch, add
Peeps / fix verification to the required status checks, so a fix can’t merge before Peeps has verified it.What the workflow does
- It approves only Peeps’ own fixes. The pull request must have been opened by the Peeps app, from a
peeps/branch in your repository, and carry thepeeps:auto-approvelabel. - It approves only a verified commit. The pull request’s latest commit must have a passing
Peeps / fix verificationcheck from the Peeps app itself. A check with the same name from anything else doesn’t count. - It never runs the pull request’s code. It runs on
pull_request_targetand never checks the branch out. Its token can only write pull requests and read checks. - A later push takes the approval back. If someone pushes to the fix’s branch, the workflow dismisses its approval unless Peeps verifies the new commit too. A person’s change then waits for a person’s review.
- It only approves. Peeps turns on auto-merge as the Peeps app, because a merge made with the workflow’s own token starts none of your other workflows, such as a deploy on merge.
When the merge doesn’t happen
- Auto-merge is off in the repository. The label stays, and the fix waits for a person to merge it, or for Merge in Peeps.
- Nothing is in the way. When a fix needs no review and no checks, GitHub won’t wait to merge it. Peeps then merges it at once, at the commit it verified.
- A rule still isn’t met. Auto-merge waits, as it would for any pull request. The Fix pull requests tab shows what the fix is waiting on.
A ruleset bypass for the Peeps app
If your branch requires an approving review and you’d rather not run a workflow, you can add the Peeps app as a bypass actor on that ruleset. Merge in Peeps can then merge a ready fix without the review (see Merge from Peeps).Route reviews with CODEOWNERS
When fixes need a person, send them to the people who own the tests rather than to whoever owns the app code. Add your test root toCODEOWNERS with your QA team:
CODEOWNERS
Security notes
- The rule can only approve fixes that Peeps’ review classed as changing how the test finds or waits for things, that passed the first time in your own CI, and that are still at the commit Peeps verified.
- The workflow trusts the check by the app that posted it, not by its name.
- Your branch rules still decide the merge. Approve by rule adds one approval and doesn’t skip any rule.
- To stop, uncheck the rule and click Save rule. Fixes that already have the label keep auto-merge until you turn it off on the pull request or remove the workflow.
GitLab
Approve by rule isn’t available on GitLab yet. Until it is:- Merge from Peeps. Ready fixes have a Merge button in Peeps (see Merge from Peeps), which follows your project’s merge rules.
- Route reviews. GitLab’s code owners (Premium) can send changes under your test root to your QA group, as above.