Skip to content

Commit

Permalink
Optimize auto approval workflow (#5328)
Browse files Browse the repository at this point in the history
* Optimize auto approval workflow

* Fix syntax
  • Loading branch information
banesullivan committed Dec 12, 2023
1 parent 60dd29d commit a572bb7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@ 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(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
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:"
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 }}

1 comment on commit a572bb7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.