-
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.18 KB
/
auto-approve.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Auto-merge automated PRs
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: |
github.actor == 'dependabot[bot]' || (
github.actor == 'laneybot[bot]' &&
startsWith(github.event.pull_request.head.ref, 'auto-merge/')
)
steps:
- name: Generate installation token
id: generate-installation-token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
with:
app-id: ${{ secrets.LANEYBOT_APP_ID }}
private-key: ${{ secrets.LANEYBOT_PRIVATE_KEY }}
- name: Approve a PR
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ github.token }}
run: >
gh pr review --approve "${PR_URL}" --body "PR from @${{ github.actor
}} automatically approved by the '${{ github.workflow }}' workflow"
- name: Enable auto-merge for automated PRs
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ steps.generate-installation-token.outputs.token }}
run: gh pr merge --auto --rebase "${PR_URL}"