From b7626b1cc483ee6fa455df6781fb08862abf4a38 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 13 Jul 2021 23:49:15 -0700 Subject: [PATCH] Approve submission PRs before auto-merging This change to the "Manage PRs" workflow will cause the "github-actions" bot to add an approval pull request review to submission PRs after they have passed all compliance checks, but before merging. This is necessary to allow us to instate the "Require pull request reviews before merging" branch protection rule on `main`, which will protect the repository from accidental pushes by the maintainers and administrators with write permissions in the repository. As an added benefit, this will more clearly indicate the status of a submission in the case where it is fully compliant with the Library Manager requirements but an automated merge is not possible due to a merge conflict. In this case, the bot will add an approval each time the workflow is triggered, but that is a reasonable behavior, and one permitted by the PR review system (i.e., subsequent approvals will not cause a spurious workflow run failure, with either workflow trigger event type). --- .github/workflows/manage-prs.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/manage-prs.yml b/.github/workflows/manage-prs.yml index 67440adb..0d1b3b9f 100644 --- a/.github/workflows/manage-prs.yml +++ b/.github/workflows/manage-prs.yml @@ -342,6 +342,17 @@ jobs: runs-on: ubuntu-latest steps: + - name: Approve pull request + uses: octokit/request-action@v2.x + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + route: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews + owner: ${{ github.repository_owner }} + repo: ${{ github.event.repository.name }} + pull_number: ${{ github.event.pull_request.number }}${{ github.event.issue.number }} + event: APPROVE + - name: Merge pull request uses: octokit/request-action@v2.x env: