-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (35 loc) · 1.12 KB
/
pre-commit-ci-auto-merge.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
name: pre-commit-ci-auto-merge
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'pre-commit-ci[bot]'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Auto merge PR
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
const repoOwner = context.repo.owner;
const repoName = context.repo.repo;
// Create a pull request review and approve it
await github.rest.pulls.createReview({
owner: repoOwner,
repo: repoName,
pull_number: prNumber,
event: 'APPROVE'
});
// Merge the pull request
await github.rest.pulls.merge({
owner: repoOwner,
repo: repoName,
pull_number: prNumber,
merge_method: 'squash' // You can change this to 'merge' or 'rebase'
});
github-token: ${{ secrets.AUTO_MERGE_JSON2GRAPH_PRE_COMMIT_CI }}