-
-
Notifications
You must be signed in to change notification settings - Fork 1
33 lines (31 loc) · 1.04 KB
/
approve_and_merge.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
name: "Auto approve Pull Requests and enable auto-merge"
on:
pull_request_target
jobs:
worker:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: automerge
uses: actions/[email protected]
with:
github-token: "${{ secrets.GH_TOKEN }}"
script: |
await github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'APPROVE'
})
const res = await github.graphql(`query {
repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") {
pullRequest(number: ${context.issue.number}) {
id
}
}
}`)
await github.graphql(`mutation {
enablePullRequestAutoMerge(input: { pullRequestId: "${res.repository.pullRequest.id}", mergeMethod: SQUASH }) {
clientMutationId
}
}`)