Skip to content

Commit 6bdd1fb

Browse files
committed
ci(tailor): enable automerge
Signed-off-by: Martin Wimpress <code@wimpress.io>
1 parent 8491230 commit 6bdd1fb

2 files changed

Lines changed: 77 additions & 1 deletion

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Tailor automerge 🤖
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
automerge:
13+
runs-on: ubuntu-slim
14+
if: github.event_name == 'pull_request'
15+
steps:
16+
- name: Fetch Dependabot metadata
17+
if: github.event.pull_request.user.login == 'dependabot[bot]'
18+
id: metadata
19+
uses: dependabot/fetch-metadata@v2
20+
with:
21+
github-token: "${{ secrets.GITHUB_TOKEN }}"
22+
skip-commit-verification: true
23+
24+
- name: Automerge GitHub Actions updates
25+
if: >-
26+
github.event.pull_request.user.login == 'dependabot[bot]'
27+
&& steps.metadata.outputs.package-ecosystem == 'github_actions'
28+
run: gh pr merge --auto --squash "$PR_URL"
29+
env:
30+
PR_URL: ${{ github.event.pull_request.html_url }}
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Automerge patch and minor dependency updates
34+
if: >-
35+
github.event.pull_request.user.login == 'dependabot[bot]'
36+
&& steps.metadata.outputs.package-ecosystem != 'github_actions'
37+
&& (
38+
steps.metadata.outputs.update-type == 'version-update:semver-patch'
39+
|| steps.metadata.outputs.update-type == 'version-update:semver-minor'
40+
)
41+
run: gh pr merge --auto --squash "$PR_URL"
42+
env:
43+
PR_URL: ${{ github.event.pull_request.html_url }}
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Automerge flake.lock update
47+
if: >-
48+
github.event.pull_request.user.login == 'github-actions[bot]'
49+
&& startsWith(github.event.pull_request.head.ref, 'update_flake_lock')
50+
run: gh pr merge --auto --squash "$PR_URL"
51+
env:
52+
PR_URL: ${{ github.event.pull_request.html_url }}
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
automerge-existing:
56+
runs-on: ubuntu-slim
57+
if: github.event_name == 'workflow_dispatch'
58+
steps:
59+
- name: Merge open Dependabot PRs
60+
run: |
61+
gh pr list --repo "$GITHUB_REPOSITORY" \
62+
--author "app/dependabot" \
63+
--state open \
64+
--json number,url \
65+
--jq '.[].url' |
66+
while read -r pr_url; do
67+
echo "::group::Merging $pr_url"
68+
if gh pr merge --squash "$pr_url"; then
69+
echo "Merged $pr_url"
70+
else
71+
echo "::warning::Failed to merge $pr_url"
72+
fi
73+
echo "::endgroup::"
74+
done
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.tailor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repository:
1717
merge_commit_message: PR_TITLE
1818
delete_branch_on_merge: true
1919
allow_update_branch: false
20-
allow_auto_merge: false
20+
allow_auto_merge: true
2121
web_commit_signoff_required: false
2222
default_workflow_permissions: read
2323
can_approve_pull_request_reviews: false

0 commit comments

Comments
 (0)