-
Notifications
You must be signed in to change notification settings - Fork 0
287 lines (262 loc) · 8.56 KB
/
use-action.yml
File metadata and controls
287 lines (262 loc) · 8.56 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: Smoke Test (Released Action)
on:
workflow_dispatch:
inputs:
run:
description: 'workflow run'
required: true
default: 'true'
workflow_run:
workflows: ["Create release"]
types:
- completed
permissions:
contents: write
jobs:
smoke-test-tag-reference:
name: Smoke Test (Tag Reference)
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Create Test File
run: |
echo "$(date +%s)-$RANDOM" > test/test1.txt
- name: Commit to repository
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
commit_message: test1 ${{ github.run_id }}!
branch: test
repository_path: test
file_pattern: .
tag_name: test1-${{ github.run_id }}
tag_message: test1 ${{ github.run_id }}
tag_reference: v1.0.1
# pr_labels: "test,automated,tag-reference-test"
github_token: ${{ secrets.PAT_TOKEN }}
- name: Confirm Tag Reference
run: |
git show -1 v1.0.1
git show -1 test1-${{ github.run_id }}
- name: Delete Tag
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
tag_name: test1-${{ github.run_id }}
delete_tag: true
github_token: ${{ secrets.PAT_TOKEN }}
smoke-test-auto-branch-false:
name: Smoke Test (Auto Branch False)
needs: [smoke-test-tag-reference]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Commit to repository
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: test
create_pr: true
auto_branch: false
pr_title: test-to-main-pr-title
pr_base: main
pr_branch: test
repository_path: test
file_pattern: .
github_token: ${{ secrets.PAT_TOKEN }}
pr_labels: "test,automated,auto-branch-false-test"
smoke-test-auto-branch-true:
name: Smoke Test (Auto Branch True)
needs: [smoke-test-auto-branch-false]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Create Test File
run: |
echo "$(date +%s)-$RANDOM" > test/test-auto-branch.txt
- name: Commit to repository
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: test
create_pr: true
auto_branch: true
pr_base: main
repository_path: test
file_pattern: .
delete_source_branch: true
github_token: ${{ secrets.PAT_TOKEN }}
pr_labels: "test,automated,auto-branch-true-test"
smoke-test-skip-if-empty:
name: Smoke Test (Skip If Empty)
runs-on: ubuntu-latest
needs: [smoke-test-auto-branch-true]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 10
token: ${{ secrets.PAT_TOKEN }}
- name: Test Skip If Empty (should skip - no changes)
id: skip-test
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: test
create_pr: true
auto_branch: false
pr_base: main
pr_branch: test
repository_path: test
file_pattern: .
skip_if_empty: true
pr_title: "Test Skip If Empty - No Changes (should skip)"
pr_labels: "test,automated,skip-if-empty-test"
github_token: ${{ secrets.PAT_TOKEN }}
pr_closed: true
- name: Verify Skip Output
run: |
echo "skipped=${{ steps.skip-test.outputs.skipped }}"
if [ "${{ steps.skip-test.outputs.skipped }}" != "true" ]; then
echo "FAIL: expected skipped=true"
exit 1
fi
echo "PASS: skip output verified"
# Verify skip does not happen when changes exist
- name: Create Test File
run: |
echo "$(date +%s)-$RANDOM" > test/skip-test.txt
- name: Test Skip If Empty (should not skip - with changes)
id: no-skip-test
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: test
create_pr: true
auto_branch: true
pr_base: main
repository_path: test
file_pattern: .
skip_if_empty: true
delete_source_branch: true
pr_title: "Test Skip If Empty - With Changes (should not skip)"
pr_labels: "test,automated,skip-if-empty-test"
github_token: ${{ secrets.PAT_TOKEN }}
pr_closed: true
- name: Verify No-Skip Output
run: |
echo "skipped=${{ steps.no-skip-test.outputs.skipped }}"
echo "pr_number=${{ steps.no-skip-test.outputs.pr_number }}"
if [ "${{ steps.no-skip-test.outputs.skipped }}" = "true" ]; then
echo "FAIL: expected skipped!=true"
exit 1
fi
echo "PASS: no-skip output verified"
smoke-test-pr-auto-close:
name: Smoke Test (PR Auto Close)
runs-on: ubuntu-latest
needs: [smoke-test-skip-if-empty]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 10
token: ${{ secrets.PAT_TOKEN }}
- name: Test PR Auto Close
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: test
pr_branch: test
create_pr: true
pr_base: main
repository_path: test
file_pattern: .
pr_closed: true
pr_title: "Test Auto Close PR"
pr_labels: "test,automated,auto-close-pr-body-test"
pr_body: |
## Test Auto Close PR
This PR will be automatically closed after creation.
github_token: ${{ secrets.PAT_TOKEN }}
smoke-test-pr-dry-run:
name: Smoke Test (PR Dry Run)
runs-on: ubuntu-latest
needs: [smoke-test-pr-auto-close]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 10
token: ${{ secrets.PAT_TOKEN }}
- name: Test PR Dry Run (auto_branch false)
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: main
create_pr: true
auto_branch: false
pr_title: "Test PR Dry Run"
pr_base: test
pr_branch: main
pr_labels: "test,automated,dry-run-test"
repository_path: "test"
file_pattern: "pr-dry-run-test.txt"
github_token: ${{ secrets.PAT_TOKEN }}
pr_dry_run: true
- name: Test PR Dry Run with Draft
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: main
create_pr: true
auto_branch: false
pr_title: "Test PR Dry Run (Draft)"
pr_base: test
pr_branch: main
pr_labels: "test,automated,draft-pr-test"
repository_path: "test"
file_pattern: "pr-dry-run-test.txt"
github_token: ${{ secrets.PAT_TOKEN }}
pr_draft: true
pr_dry_run: true
- name: Test PR Dry Run with Reviewers and Assignees
uses: somaz94/go-git-commit-action@v1
with:
user_email: actions@github.com
user_name: GitHub Actions
branch: main
create_pr: true
auto_branch: false
pr_title: "Test PR Dry Run (Reviewers/Assignees)"
pr_base: test
pr_branch: main
pr_labels: "test,automated,reviewers-test"
pr_reviewers: "somaz94"
pr_assignees: "somaz94"
repository_path: "test"
file_pattern: "pr-dry-run-test.txt"
github_token: ${{ secrets.PAT_TOKEN }}
pr_dry_run: true