Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
ci: pr auto approve: On review
Browse files Browse the repository at this point in the history
  • Loading branch information
John Andersen authored Jul 11, 2024
1 parent 32bf01a commit 2dfacd2
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/00_pr_auto_approve.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
name: "00 PR Auto approve"

on:
workflow_dispatch: null

permissions:
contents: read
pull_request: null
repository_dispatch:
types:
- approve-pr
pull_request_review:
types:
- submitted

# https://github.com/marketplace/actions/repository-dispatch
jobs:
auto-approve:
trigger-approve-pr:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request_review' && contains(fromJson('["pdxjohnny"]'), github.event.actor) }}
steps:
- name: 'Repository Dispatch: approve-pr'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
event-type: approve-pr
client-payload: |-
{
"actor": "${{ github.actor }}",
"pull_request": {
"number": "${{ github.event.pull_request.number }}"
}
}
approve-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: contains(fromJson('["dependabot[bot]", "github-actions[bot]", "pdxjohnny"]'), github.actor)
if: ${{ github.event_name == 'repository_dispatch' && contains(fromJson('["dependabot[bot]", "github-actions[bot]", "pdxjohnny"]'), github.event.actor) }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
Expand All @@ -22,7 +44,7 @@ jobs:
with:
review-message: "LGTM"

- if: contains(fromJson('["dependabot[bot]", "github-actions[bot]"]'), github.actor)
- if: contains(fromJson('["dependabot[bot]", "github-actions[bot]"]'), github.event.actor)
env:
GH_TOKEN: ${{ github.token }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
Expand Down

0 comments on commit 2dfacd2

Please sign in to comment.