8
8
description : ' Enter the tfcheck action name.'
9
9
required : false
10
10
type : string
11
+ tfchecks_azure :
12
+ description : ' List of Azure TF checks (JSON array as string)'
13
+ required : false
14
+ type : string
15
+ default : ' ["pr-validation / 📝 Validate PR title", "pr-validation / 🧾 Validate Commit Messages", "tf-lint / tflint"]'
16
+ azure_cloud :
17
+ description : ' Enable Azure-specific checks'
18
+ required : false
19
+ type : boolean
20
+ default : false
11
21
secrets :
12
22
GITHUB :
13
23
description : ' GitHub Token'
20
30
strategy :
21
31
matrix :
22
32
tf-checks : ["tf-lint / tflint", "tfsec / tfsec sarif report", "${{ inputs.tfcheck }}"]
23
- if : github.actor == 'dependabot[bot]'
33
+ if : github.actor == 'dependabot[bot]' && !inputs.azure_cloud
34
+ steps :
35
+ - name : Wait for 2 Minutes
36
+ run : sleep 120s
37
+ shell : bash
38
+
39
+ - name : Wait for "${{ matrix.tf-checks }}" to Succeed
40
+
41
+ with :
42
+ ref : ${{ github.event.pull_request.head.sha }}
43
+ check-name : ${{ matrix.tf-checks }}
44
+ repo-token : ${{ secrets.GITHUB || secrets.GITHUB_TOKEN }}
45
+ wait-interval : 30
46
+ allowed-conclusions : success
47
+
48
+ static-checks-azure :
49
+ name : Check Static Analysis for Azure
50
+ runs-on : ubuntu-latest
51
+ permissions :
52
+ contents : read
53
+ checks : read
54
+ pull-requests : read
55
+ if : |
56
+ github.actor == 'dependabot[bot]' &&
57
+ inputs.azure_cloud == true &&
58
+ inputs.tfchecks_azure != '[]'
59
+ strategy :
60
+ matrix :
61
+ tf-checks : ${{ fromJSON(inputs.tfchecks_azure) }}
24
62
steps :
25
63
- name : Wait for 2 Minutes
26
64
run : sleep 120s
31
69
with :
32
70
ref : ${{ github.event.pull_request.head.sha }}
33
71
check-name : ${{ matrix.tf-checks }}
34
- repo-token : ${{ secrets.GITHUB }}
72
+ repo-token : ${{ secrets.GITHUB || secrets.GITHUB_TOKEN }}
35
73
wait-interval : 30
36
74
allowed-conclusions : success
37
75
40
78
contents : write
41
79
pull-requests : write
42
80
name : Auto Approve PRs by Dependabot
43
- needs : static-checks
81
+ needs : [ static-checks, static-checks-azure]
44
82
runs-on : ubuntu-latest
45
- if : github.actor == 'dependabot[bot]'
83
+ if : |
84
+ always() &&
85
+ github.actor == 'dependabot[bot]' &&
86
+ (needs.static-checks.result == 'success' || needs.static-checks-azure.result == 'success')
46
87
steps :
47
88
- name : Approve PR via GitHub Bot
48
89
run : gh pr review --approve "$PR_URL"
@@ -59,15 +100,19 @@ jobs:
59
100
automerge :
60
101
runs-on : ubuntu-latest
61
102
needs : autoapprove
103
+ if : |
104
+ always() &&
105
+ needs.autoapprove.result == 'success' &&
106
+ github.event_name == 'pull_request' &&
107
+ github.event.pull_request.draft == false
62
108
steps :
63
109
- name : Automerge
64
110
65
- if : github.event_name == 'pull_request' && github.event.pull_request.draft == false
66
111
env :
67
112
GITHUB_TOKEN : ${{ secrets.GITHUB }}
68
113
MERGE_FILTER_AUTHOR : ' dependabot[bot]'
69
114
MERGE_METHOD : " merge"
70
115
MERGE_DELETE_BRANCH : " true"
71
116
MERGE_LABELS : " dependencies, github_actions"
72
117
MERGE_REQUIRED_APPROVALS : " "
73
- ...
118
+ ...
0 commit comments