Auto-Approval & Merge Policy
Template PolicyThis template policy automatically approves pull requests authored by trusted bots and principal engineers. Also, it automatically approves pull requests with changes that considered low risk based on their file paths. It uses groups to combine existing GitHub users, CI checks and file patterns. When the pull request is authored by a trusted bot, Reviewpad waits for the mandatory checks to finish and automatically merges if they are successful.
groups: - name: trusted-bots spec: '["renovate-bot", "snyk-bot", "dependabot"]' - name: mandatory-checks spec: '["build"]' - name: low-risk-filepaths spec: '["aux/.*", ".*\.md", ".*\.txt"]' - name: principal-engineers spec: '["johndoe", "janedoe"]' workflows: - name: Auto-approval and Merge Policy run: - if: '$isElementOf($author(), $group("principal-engineers"))' then: $approve("This PR is automatically approved as it was created by a principal engineer.") - if: '$all($filesPath(), ($fp: String => $any($group("low-risk-filepaths"), ($pat: String => $matchString($pat, $fp)))))' then: $approve("This PR has been automatically approved as it only modifies low risk files.") - if: $isElementOf($author(), $group("trusted-bots")) then: - $approve($sprintf("This PR is automatically approved as it was created by trustable bot %s.", [$author()])) - if: '$all($group("mandatory-checks"), ($check : String => $checkRunConclusion($check) == "success"))' then: $merge()