Skip to content

Commit 7ca2e39

Browse files
ci(github): refactor auto-approve.yml
1 parent 99ffea0 commit 7ca2e39

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/auto-approve.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
name: Auto Approve
2-
on: [push, pull_request_target]
2+
on: pull_request
3+
4+
permissions:
5+
pull-requests: write
36

47
jobs:
58
auto-approve:
6-
if: github.event_name == 'pull_request_target'
79
runs-on: ubuntu-latest
10+
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
11+
timeout-minutes: 1
812

913
steps:
10-
- name: Approve Dependabot PR
11-
if: github.actor == 'dependabot[bot]'
12-
run: gh pr review --approve $PR_URL
14+
- name: Approve PR
15+
run: gh pr review --approve ${{ github.event.pull_request.html_url }}
1316
env:
14-
PR_URL: ${{ github.event.pull_request.html_url }}
1517
GH_TOKEN: ${{ github.token }} # or `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
1618

1719
# https://github.com/hmarr/auto-approve-action
1820
- name: Auto Approve
1921
uses: hmarr/auto-approve-action@v4
20-
if: github.actor == 'dependabot[bot]'
2122
with:
2223
github-token: ${{ github.token }}

0 commit comments

Comments
 (0)