-
Notifications
You must be signed in to change notification settings - Fork 7
50 lines (45 loc) · 1.59 KB
/
auto-merge-dependencies.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
name: Enables auto-merge on dependency pull requests
on:
pull_request:
branches:
- main
workflow_dispatch: {}
jobs:
enable-automerge:
if: |
contains(github.event.pull_request.labels.*.name, 'automerge')
&&
contains(github.event.pull_request.labels.*.name, 'dependencies')
&& (
contains(github.event.pull_request.labels.*.name, 'minor')
|| contains(github.event.pull_request.labels.*.name, 'patch')
)
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: find_branch_name
id: find_branch_name
run: |
gh repo view --json nameWithOwner,defaultBranchRef | jq -r '.defaultBranchRef.name'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Find Pull Request
uses: juliangruber/find-pull-request-action@48b6133aa6c826f267ebd33aa2d29470f9d9e7d0 # v1
id: find-pull-request
with:
branch: ${{ steps.find_branch_name.outputs.text }}
- name: Auto approve
id: autoApprove
uses: juliangruber/approve-pull-request-action@6b8b2f82d50cea1e4329bcdfe940a6ceccbe528e # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.find-pull-request.outputs.number }}
- name: Enable auto-merge
run: |
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}