-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (67 loc) · 2.04 KB
/
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
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
---
name: Automerge
on:
workflow_call:
inputs:
tfcheck:
description: 'Enter the tfcheck action name.'
required: false
type: string
secrets:
GITHUB:
description: 'GitHub Token'
required: false
jobs:
static-checks:
name: Check Static Analysis
runs-on: ubuntu-latest
strategy:
matrix:
tf-checks: ["tf-lint / tflint", "tfsec / tfsec sarif report", "${{ inputs.tfcheck }}"]
if: github.actor == 'dependabot[bot]'
steps:
- name: Wait for 2 Minutes
run: sleep 120s
shell: bash
- name: Wait for "${{ matrix.tf-checks }}" to Succeed
uses: lewagon/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: ${{ matrix.tf-checks }}
repo-token: ${{ secrets.GITHUB }}
wait-interval: 30
allowed-conclusions: success
autoapprove:
permissions:
contents: write
pull-requests: write
name: Auto Approve PRs by Dependabot
needs: static-checks
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Approve PR via GitHub Bot
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Approve PR via Anmol Nagpal
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB}}
automerge:
runs-on: ubuntu-latest
needs: autoapprove
steps:
- name: Automerge
uses: pascalgn/[email protected]
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB }}
MERGE_FILTER_AUTHOR: 'dependabot[bot]'
MERGE_METHOD: "merge"
MERGE_DELETE_BRANCH: "true"
MERGE_LABELS: "dependencies, github_actions"
MERGE_REQUIRED_APPROVALS: ""
...