Skip to content

[release-23.0] CI: generate error code docs from trusted commits only (#20789) #4894

[release-23.0] CI: generate error code docs from trusted commits only (#20789)

[release-23.0] CI: generate error code docs from trusted commits only (#20789) #4894

name: Auto Approval of Bot Pull Requests
on:
pull_request:
types: [opened, reopened]
permissions:
contents: read
jobs:
auto_approve:
name: Auto Approve Pull Request
runs-on: ubuntu-24.04
permissions:
pull-requests: write # only given on local PRs, forks run with `read` access
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
- name: Auto Approve Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_DRAFT: ${{ github.event.pull_request.draft }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# here we are checking that the PR has been created by the vitess-bot[bot] account and that it is not a draft
# if there is a merge conflict in the backport, the PR will always be created as a draft, meaning we can rely
# on checking whether or not the PR is a draft
if [[ "$PR_AUTHOR" == "vitess-bot[bot]" ]] && [[ "$PR_DRAFT" == "false" ]]; then
gh pr review "$PR_NUMBER" --approve
fi