Skip to content

Commit c503268

Browse files
committed
ci(workflows): add auto-merge
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 8dd024e commit c503268

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/auto-merge.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Pull request auto-merge
2+
#
3+
# Automatically merge pull requests after requirements are met.
4+
#
5+
# References:
6+
#
7+
# - https://cli.github.com/manual/gh_pr_merge
8+
# - https://docs.github.com/actions/learn-github-actions/contexts
9+
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
10+
# - https://docs.github.com/actions/using-workflows/using-github-cli-in-workflows
11+
# - https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository
12+
# - https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
13+
# - https://github.com/actions/checkout
14+
# - https://github.com/hmarr/debug-action
15+
16+
---
17+
name: auto-merge
18+
on:
19+
pull_request:
20+
types:
21+
- opened
22+
- synchronize
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.PAT_REPO }}
25+
jobs:
26+
auto-merge:
27+
if: github.event.pull_request.auto_merge == null && github.event.pull_request.draft == false
28+
runs-on: ubuntu-latest
29+
steps:
30+
- id: debug
31+
name: Print environment variables and event payload
32+
uses: hmarr/[email protected]
33+
- id: checkout
34+
name: Checkout ${{ github.head_ref }}
35+
uses: actions/[email protected]
36+
with:
37+
persist-credentials: false
38+
ref: ${{ github.head_ref }}
39+
- id: enable
40+
name: Enable auto-merge
41+
run: gh pr merge ${{ github.event.number }} --auto --squash

0 commit comments

Comments
 (0)