File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change 1
- name : " Auto approve and merge Pull Requests"
1
+ name : " Auto approve Pull Requests and enable auto-merge "
2
2
on :
3
3
pull_request_target
4
4
jobs :
5
5
worker :
6
6
runs-on : ubuntu-latest
7
7
if : github.actor == 'dependabot[bot]'
8
8
steps :
9
- - name : Auto approve and merge Pull Request
9
+ - name : automerge
10
10
11
11
with :
12
- github-token : " ${{ secrets.GITHUB_TOKEN }}"
12
+ github-token : " ${{ secrets.GH_TOKEN }}"
13
13
script : |
14
14
await github.pulls.createReview({
15
15
owner: context.repo.owner,
16
16
repo: context.repo.repo,
17
17
pull_number: context.issue.number,
18
- event: "APPROVE"
19
- })
20
- await github.pulls.merge({
21
- owner: context.repo.owner,
22
- repo: context.repo.repo,
23
- pull_number: context.issue.number,
24
- merge_method: "squash"
18
+ event: 'APPROVE'
25
19
})
20
+
21
+ const res = await github.graphql(`query {
22
+ repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") {
23
+ pullRequest(number: ${context.issue.number}) {
24
+ id
25
+ }
26
+ }
27
+ }`)
28
+
29
+ await github.graphql(`mutation {
30
+ enablePullRequestAutoMerge(input: { pullRequestId: "${res.repository.pullRequest.id}" }) {
31
+ clientMutationId
32
+ }
33
+ }`)
You can’t perform that action at this time.
0 commit comments