-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (42 loc) · 1.62 KB
/
wc-enable-auto-merge-and-approve.yaml
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
39
40
41
42
---
name: enable-auto-merge-and-approve
on:
workflow_call:
secrets:
gh_app_id:
required: true
gh_app_private_key:
required: true
gh_token:
required: true
jobs:
enable-auto-merge-and-approve:
# This job is used for main branch's branch protection rule's status check.
# If all dependent jobs succeed or are skipped this job succeeds.
runs-on: ubuntu-latest
environment: renovate
permissions: {}
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # v1.8.0
with:
app_id: ${{secrets.gh_app_id}}
private_key: ${{secrets.gh_app_private_key}}
- run: gh -R "$GITHUB_REPOSITORY" pr merge --merge --auto --delete-branch "$PR_NUMBER"
env:
GITHUB_TOKEN: ${{steps.generate_token.outputs.token}} # Use GitHub App to trigger GitHub Actions Workflow by merge commit.
PR_NUMBER: ${{github.event.pull_request.number}}
# https://github.com/cli/cli/issues/6680
# HTTP 401: Personal access tokens with fine grained access do not support the GraphQL API (https://api.github.com/graphql)
# - run: gh -R aquaproj/example-update-checksum pr review -a "$PR_NUMBER"
- name: Approve a pull request
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
"/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \
-f event='APPROVE'
env:
PR_NUMBER: ${{github.event.pull_request.number}}
GITHUB_TOKEN: ${{secrets.gh_token}}