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

Commit 4548484

Browse files
John Andersenliceoa
authored andcommitted
ci: pr auto approve: On review
1 parent 2c7e9f1 commit 4548484

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

.github/workflows/00_pr_auto_approve.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,39 @@
11
name: "00 PR Auto approve"
22

33
on:
4-
workflow_dispatch: null
5-
6-
permissions:
7-
contents: read
4+
pull_request: null
5+
repository_dispatch:
6+
types:
7+
- approve-pr
8+
pull_request_review:
9+
types:
10+
- submitted
811

12+
# https://github.com/marketplace/actions/repository-dispatch
913
jobs:
10-
auto-approve:
14+
trigger-approve-pr:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event_name == 'pull_request_review' && contains(fromJson('["pdxjohnny"]'), github.event.actor) }}
17+
steps:
18+
- name: 'Repository Dispatch: approve-pr'
19+
uses: peter-evans/repository-dispatch@v3
20+
with:
21+
token: ${{ github.token }}
22+
repository: ${{ github.repository }}
23+
event-type: approve-pr
24+
client-payload: |-
25+
{
26+
"actor": "${{ github.actor }}",
27+
"pull_request": {
28+
"number": "${{ github.event.pull_request.number }}"
29+
}
30+
}
31+
32+
approve-pr:
1133
runs-on: ubuntu-latest
1234
permissions:
1335
pull-requests: write
14-
if: contains(fromJson('["dependabot[bot]", "github-actions[bot]", "pdxjohnny"]'), github.actor)
36+
if: ${{ github.event_name == 'repository_dispatch' && contains(fromJson('["dependabot[bot]", "github-actions[bot]", "pdxjohnny"]'), github.event.actor) }}
1537
steps:
1638
- name: Harden Runner
1739
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
@@ -22,7 +44,7 @@ jobs:
2244
with:
2345
review-message: "LGTM"
2446

25-
- if: contains(fromJson('["dependabot[bot]", "github-actions[bot]"]'), github.actor)
47+
- if: contains(fromJson('["dependabot[bot]", "github-actions[bot]"]'), github.event.actor)
2648
env:
2749
GH_TOKEN: ${{ github.token }}
2850
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)