-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 2.5 KB
/
merge-bot-pr.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
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
name: Merge bot PR after CI
on: pull_request
permissions:
contents: write
pull-requests: write
# checks: read # For private repositories
# actions: read # For private repositories
jobs:
judge-dependabot:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
merge: ${{ steps.conclusion.outputs.merge }}
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: dependabot
uses: dependabot/[email protected]
- name: Judge
id: conclusion
if: >-
steps.dependabot.outputs.update-type != 'version-update:semver-major' || contains(steps.dependabot.outputs.dependency-names, 'DeterminateSystems')
run: echo -n 'merge=true' | tee -a "$GITHUB_OUTPUT"
dependabot:
needs: [judge-dependabot]
if: ${{ needs.judge-dependabot.outputs.merge == 'true' }}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Wait other jobs
uses: kachick/wait-other-jobs@v2
timeout-minutes: 30
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
retry-method: 'equal_intervals'
min-interval-seconds: '15'
- name: Approve and merge
run: gh pr review --approve "$PR_URL" && gh pr merge --auto --squash --delete-branch "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Avoid `automerge` renovate official feature.
# It wait longtime to be merged.
# Avoid `platformAutomerge` renovate official feature.
# It requires many changes in GitHub settings.
# - `Allow auto-merge`
# - `Require status checks to pass before merging` and specify the status names
# Changing in all personal repository is annoy task for me. Even if using terrafform, getting mandatory CI names in each repo is too annoy!
renovate:
runs-on: ubuntu-latest
if: ${{ github.actor == 'renovate[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Wait other jobs
uses: kachick/wait-other-jobs@v2
timeout-minutes: 30
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
retry-method: 'equal_intervals'
min-interval-seconds: '15'
- name: Approve and merge
run: gh pr review --approve "$PR_URL" && gh pr merge --auto --squash --delete-branch "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}