Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create auto-review workflow to approve PRs that pass test that I auth… #24

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/auto-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a single-maintainer project but I want to require reviews before
# merge, which means that I need a bot to review my own work.
name: Automatic pull request approvals
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- ready_for_review
check_suite:
types:
- completed
jobs:
auto-approve:
runs-on: ubuntu-latest
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.draft == false && (
github.event.action == 'opened' ||
github.event.action == 'reopened' ||
github.event.action == 'synchronize'
) && (
github.actor == 'jaqx0r'
)
permissions:
# wait on check
checks: read
# create review
pull-requests: write
steps:
- uses: lewagon/wait-on-check-action@v1.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: test
repo-token: ${{ github.token }}
wait-interval: 60

- uses: "actions/github-script@v5"
with:
github-token: ${{ github.token }}
script: |
await github.rest.pulls.createReview({
event: "APPROVE",
owner: context.repo.owner,
pull_number: context.payload.pull_request.number,
repo: context.repo.repo,
})