From d02337d629856d3678e4fcf6f03cf3ff7d8bce35 Mon Sep 17 00:00:00 2001 From: Bane Sullivan Date: Mon, 11 Dec 2023 22:29:24 -0800 Subject: [PATCH 1/2] Optimize auto approval workflow --- .github/workflows/auto-approve.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 9ee28a6b84..318d69e6b3 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -2,24 +2,21 @@ name: Approve PRs on: workflow_dispatch: issue_comment: - types: [created, edited] - -env: - # sintax: ("tkoyama010" "author2") - ALLOWED_AUTHORS: ("tkoyama010", "banesullivan", "akaszynski") + types: [created] jobs: autoapprove: - # This job only runs for pull request comments + # This job only runs for pull request comments by approved users on creation name: PR comment - if: ${{ github.event.issue.pull_request }} + if: ${{ + github.event.issue.pull_request && + contains(("tkoyama010", "banesullivan", "akaszynski"), github.event.comment.user.login) && + contains(github.event.comment.body, '@pyvista-bot LGTM') }} permissions: pull-requests: write runs-on: ubuntu-latest steps: - uses: hmarr/auto-approve-action@v3 - if: | - contains(github.event.comment.body, '@pyvista-bot LGTM') && contains(env.ALLOWED_AUTHORS, github.event.comment.user.login) with: review-message: ":white_check_mark: Approving this PR because [${{ github.event.comment.user.login }}](https://github.com/${{ github.event.comment.user.login }}) said so in [here](${{ github.event.comment.html_url }}) :grimacing:" pull-request-number: ${{ github.event.issue.number }} From 3c112e77494efc65e64598cf46f8390f916552bc Mon Sep 17 00:00:00 2001 From: Bane Sullivan Date: Mon, 11 Dec 2023 22:49:26 -0800 Subject: [PATCH 2/2] Fix syntax --- .github/workflows/auto-approve.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 318d69e6b3..d3707d65c3 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -8,16 +8,18 @@ jobs: autoapprove: # This job only runs for pull request comments by approved users on creation name: PR comment - if: ${{ - github.event.issue.pull_request && - contains(("tkoyama010", "banesullivan", "akaszynski"), github.event.comment.user.login) && - contains(github.event.comment.body, '@pyvista-bot LGTM') }} + if: github.event.issue.pull_request && + contains(github.event.comment.body, '@pyvista-bot LGTM') && ( + github.event.comment.user.login == 'banesullivan' || + github.event.comment.user.login == 'tkoyama010' || + github.event.comment.user.login == 'akaszynski' + ) permissions: pull-requests: write runs-on: ubuntu-latest steps: - uses: hmarr/auto-approve-action@v3 with: - review-message: ":white_check_mark: Approving this PR because [${{ github.event.comment.user.login }}](https://github.com/${{ github.event.comment.user.login }}) said so in [here](${{ github.event.comment.html_url }}) :grimacing:" + review-message: ":white_check_mark: Approving this PR because [${{ github.event.comment.user.login }}](https://github.com/${{ github.event.comment.user.login }}) said so in [here](${{ github.event.comment.html_url }}) :shipit:" pull-request-number: ${{ github.event.issue.number }} github-token: ${{ secrets.PYVISTA_BOT_TOKEN }}