Skip to content

Commit

Permalink
ci: Enable auto-approval of pull requests
Browse files Browse the repository at this point in the history
This allows enforcing branch protection rules, even as a
solo developer.
  • Loading branch information
Mr-Pepe committed Jan 9, 2024
1 parent b419732 commit 572c184
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/auto_approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Auto-Approve

on:
issue_comment:
types: [created]

jobs:
auto-approve:
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request != ''
&& github.event.comment.user.login == 'Mr-Pepe'
&& contains(github.event.comment.body, 'LGTM')
permissions:
pull-requests: write
steps:
- name: Approve PR
uses: actions/github-script@v4
with:
script: |
await github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'APPROVE'
})

0 comments on commit 572c184

Please sign in to comment.