-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (84 loc) · 2.85 KB
/
pull-request-automation.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Auto reviews, merge and close pull requests
on:
pull_request:
types:
- opened
- reopened
jobs:
auto-merge:
name: Auto reviews, merge and close pull requests
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/github-script@v6
with:
script: |-
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
})
name: Auto reviews Renovate updates
if: github.event.pull_request.user.login == 'renovate[bot]'
- name: Auto review and merge dpkg updates
uses: actions/github-script@v7
if: github.event.pull_request.user.login == 'c2c-bot-gis-ci' && startsWith(github.head_ref, 'dpkg-update/')
with:
script: |-
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
});
github.graphql(`
mutation {
enablePullRequestAutoMerge(input: {
pullRequestId: "${context.payload.pull_request.node_id}",
mergeMethod: SQUASH,
}) {
pullRequest {
autoMergeRequest {
enabledAt
}
}
}
}
`)
- name: Auto review and merge snyk auto fix
uses: actions/github-script@v7
if: github.event.pull_request.user.login == 'c2c-bot-gis-ci' && startsWith(github.head_ref, 'snyk-fix/')
with:
script: |-
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
});
github.graphql(`
mutation {
enablePullRequestAutoMerge(input: {
pullRequestId: "${context.payload.pull_request.node_id}",
mergeMethod: SQUASH,
}) {
pullRequest {
autoMergeRequest {
enabledAt
}
}
}
}
`)
- name: Auto close pre-commit.ci autoupdate
uses: actions/github-script@v7
if: github.event.pull_request.user.login == 'pre-commit-ci'
with:
script: |-
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed',
});