-
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (69 loc) · 2.49 KB
/
tailor-automerge.yml
File metadata and controls
76 lines (69 loc) · 2.49 KB
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
name: Tailor automerge 🤖
on:
pull_request:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
automerge:
runs-on: ubuntu-slim
if: github.event_name == 'pull_request'
steps:
- name: Fetch Dependabot metadata
if: github.event.pull_request.user.login == 'dependabot[bot]'
id: metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
skip-commit-verification: true
- name: Automerge GitHub Actions updates
if: >-
github.event.pull_request.user.login == 'dependabot[bot]'
&& steps.metadata.outputs.package-ecosystem == 'github_actions'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Automerge patch and minor dependency updates
if: >-
github.event.pull_request.user.login == 'dependabot[bot]'
&& steps.metadata.outputs.package-ecosystem != 'github_actions'
&& (
steps.metadata.outputs.update-type == 'version-update:semver-patch'
|| steps.metadata.outputs.update-type == 'version-update:semver-minor'
)
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Automerge flake.lock update
if: >-
github.event.pull_request.user.login == 'github-actions[bot]'
&& startsWith(github.event.pull_request.head.ref, 'update_flake_lock')
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
automerge-existing:
runs-on: ubuntu-slim
if: github.event_name == 'workflow_dispatch'
steps:
- name: Merge open Dependabot PRs
run: |
gh pr list --repo "$GITHUB_REPOSITORY" \
--author "app/dependabot" \
--state open \
--json number,url \
--jq '.[].url' |
while read -r pr_url; do
echo "::group::Merging $pr_url"
if gh pr merge --squash "$pr_url"; then
echo "Merged $pr_url"
else
echo "::warning::Failed to merge $pr_url"
fi
echo "::endgroup::"
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}