Skip to content

Commit 9dc5341

Browse files
committed
ci(test.yml): set version v3 to actions/checkout
1 parent 7be8459 commit 9dc5341

1 file changed

Lines changed: 109 additions & 74 deletions

File tree

.github/workflows/test.yml

Lines changed: 109 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
on:
1+
"on":
22
push:
33
branches:
44
- master
@@ -9,40 +9,42 @@ on:
99
workflow_dispatch: {}
1010
name: Test
1111
jobs:
12-
# use no configuration. Will update existing pull request:
13-
# https://github.com/gr2m/create-or-update-pull-request-action/pull/2
1412
happyPath:
1513
name: "[TEST] Update existing pull request"
1614
runs-on: ubuntu-latest
1715
steps:
18-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1917
with:
2018
persist-credentials: false
21-
- run: "date > test.txt"
22-
- run: "npm ci"
23-
- run: "npm run build"
19+
- run: date > test.txt
20+
- run: npm ci
21+
- run: npm run build
2422
- uses: ./
2523
id: run
2624
env:
2725
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2826
ACTIONS_STEP_DEBUG: true
2927
with:
30-
commit-message: "Just testing [skip ci]"
28+
commit-message: Just testing [skip ci]
3129
- if: ${{ steps.run.outputs.result != 'updated' }}
32-
run: 'echo "Action result output is \"${{ steps.run.outputs.result }}\" but expected \"updated\"" && exit 1'
30+
run: >-
31+
echo "Action result output is \"${{ steps.run.outputs.result }}\" but
32+
expected \"updated\"" && exit 1
3333
- if: ${{ !(steps.run.outputs.pull-request-number > 0) }}
34-
run: 'echo "Action pull-request-number output is \"${{steps.run.outputs.pull-request-number}}\" but expected a number" && exit 1'
35-
34+
run: >-
35+
echo "Action pull-request-number output is
36+
\"${{steps.run.outputs.pull-request-number}}\" but expected a number"
37+
&& exit 1
3638
createNewPullRequest:
3739
name: "[TEST] Create new pull request"
3840
runs-on: ubuntu-latest
3941
steps:
40-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v3
4143
with:
4244
persist-credentials: false
43-
- run: "date > test.txt"
44-
- run: "npm ci"
45-
- run: "npm run build"
45+
- run: date > test.txt
46+
- run: npm ci
47+
- run: npm run build
4648
- uses: ./
4749
id: run
4850
env:
@@ -52,118 +54,133 @@ jobs:
5254
title: Test pull request
5355
body: This pull request is part of the CI - please ignore.
5456
branch: test-create-new-pull-request-${{ github.run_number }}
55-
commit-message: "Just testing [skip ci]"
56-
author: "J. Doe <j@example.com>"
57+
commit-message: Just testing [skip ci]
58+
author: J. Doe <j@example.com>
5759
labels: test1, test2
5860
assignees: gr2m
59-
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-create-new-pull-request-${{ github.run_number }}"
61+
- run: >-
62+
git push
63+
https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
64+
:test-create-new-pull-request-${{ github.run_number }}
6065
env:
6166
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6267
- if: ${{ steps.run.outputs.result != 'created' }}
63-
run: 'echo "result output is \"${{ steps.run.outputs.result }}\" but expected \"created\"" && exit 1'
68+
run: >-
69+
echo "result output is \"${{ steps.run.outputs.result }}\" but
70+
expected \"created\"" && exit 1
6471
- if: ${{ !(steps.run.outputs.pull-request-number > 0) }}
65-
run: 'echo "pull-request-number output is \"${{ steps.run.outputs.pull-request-number }}\" but expected a number" && exit 1'
66-
72+
run: >-
73+
echo "pull-request-number output is \"${{
74+
steps.run.outputs.pull-request-number }}\" but expected a number" &&
75+
exit 1
6776
multipleCommits:
6877
name: "[TEST] Create multiple commits"
6978
runs-on: ubuntu-latest
7079
steps:
71-
- uses: actions/checkout@v2
80+
- uses: actions/checkout@v3
7281
with:
7382
persist-credentials: false
74-
- run: "date > file1.txt"
75-
- run: "date > file2.txt"
76-
- run: "npm ci"
77-
- run: "npm run build"
83+
- run: date > file1.txt
84+
- run: date > file2.txt
85+
- run: npm ci
86+
- run: npm run build
7887
- uses: ./
7988
env:
8089
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8190
ACTIONS_STEP_DEBUG: true
8291
with:
8392
title: Test pull request with multiple commits
8493
body: This pull request is part of the CI - please ignore.
85-
branch: test-create-new-pull-request-with-multiple-commits-${{ github.run_number }}
86-
author: "J. Doe <j@example.com>"
94+
branch: >-
95+
test-create-new-pull-request-with-multiple-commits-${{
96+
github.run_number }}
97+
author: J. Doe <j@example.com>
8798
path: file1.txt
88-
commit-message: "file 1 created [skip ci]"
99+
commit-message: file 1 created [skip ci]
89100
- uses: ./
90101
env:
91102
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92103
ACTIONS_STEP_DEBUG: true
93104
with:
94105
title: Test pull request
95106
body: This pull request is part of the CI - please ignore.
96-
branch: test-create-new-pull-request-with-multiple-commits-${{ github.run_number }}
97-
author: "J. Doe <j@example.com>"
107+
branch: >-
108+
test-create-new-pull-request-with-multiple-commits-${{
109+
github.run_number }}
110+
author: J. Doe <j@example.com>
98111
path: file2.txt
99-
commit-message: "file 2 created [skip ci]"
112+
commit-message: file 2 created [skip ci]
100113
- uses: ./
101114
env:
102115
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103116
ACTIONS_STEP_DEBUG: true
104117
with:
105118
title: Test pull request
106119
body: This pull request is part of the CI - please ignore.
107-
branch: test-create-new-pull-request-with-multiple-commits-${{ github.run_number }}
108-
author: "J. Doe <j@example.com>"
120+
branch: >-
121+
test-create-new-pull-request-with-multiple-commits-${{
122+
github.run_number }}
123+
author: J. Doe <j@example.com>
109124
path: does_not_exist.txt
110-
commit-message: "this should fail silently, not commit should be created"
111-
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-create-new-pull-request-with-multiple-commits-${{ github.run_number }}"
125+
commit-message: this should fail silently, not commit should be created
126+
- run: >-
127+
git push
128+
https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
129+
:test-create-new-pull-request-with-multiple-commits-${{
130+
github.run_number }}
112131
env:
113132
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114-
115133
autoMerge:
116134
name: "[TEST] Auto merge"
117135
runs-on: ubuntu-latest
118136
steps:
119-
- uses: actions/checkout@v2
137+
- uses: actions/checkout@v3
120138
with:
121139
persist-credentials: false
122-
- run: "date > test.txt"
123-
- run: "npm ci"
124-
- run: "npm run build"
140+
- run: date > test.txt
141+
- run: npm ci
142+
- run: npm run build
125143
- uses: ./
126144
env:
127145
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128146
ACTIONS_STEP_DEBUG: true
129147
with:
130148
title: Test pull request for `auto-merge` option
131-
commit-message: "Testing auto-merge"
149+
commit-message: Testing auto-merge
132150
auto-merge: squash
133151
branch: test-auto-merge-${{ github.run_number }}
134-
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-auto-merge-${{ github.run_number }}"
152+
- run: >-
153+
git push
154+
https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
155+
:test-auto-merge-${{ github.run_number }}
135156
env:
136157
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137-
138-
# expect to detect changes in a hidden file:
139-
# https://github.com/gr2m/create-or-update-pull-request-action/pull/262
140158
hiddenFile:
141159
name: "[TEST] Create or update pull request for hidden file"
142160
runs-on: ubuntu-latest
143161
steps:
144-
- uses: actions/checkout@v2
162+
- uses: actions/checkout@v3
145163
with:
146164
persist-credentials: false
147-
- run: "date > .github/test.txt"
148-
- run: "npm ci"
149-
- run: "npm run build"
165+
- run: date > .github/test.txt
166+
- run: npm ci
167+
- run: npm run build
150168
- uses: ./
151169
env:
152170
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153171
ACTIONS_STEP_DEBUG: true
154172
with:
155-
commit-message: "Just testing [skip ci]"
156-
173+
commit-message: Just testing [skip ci]
157174
updatePRTitleAndBody:
158175
name: "[TEST] Update PR title and body"
159176
runs-on: ubuntu-latest
160177
steps:
161-
- uses: actions/checkout@v2
178+
- uses: actions/checkout@v3
162179
with:
163180
persist-credentials: false
164-
- run: "date > test.txt"
165-
- run: "npm ci"
166-
- run: "npm run build"
181+
- run: date > test.txt
182+
- run: npm ci
183+
- run: npm run build
167184
- uses: ./
168185
env:
169186
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -172,18 +189,20 @@ jobs:
172189
title: Test pull request
173190
body: This pull request is part of the CI - please ignore.
174191
branch: test-update-pr-title-and-body-${{ github.run_number }}
175-
commit-message: "Just testing [skip ci]"
176-
- run: "echo updated >> test.txt"
192+
commit-message: Just testing [skip ci]
193+
- run: echo updated >> test.txt
177194
- uses: ./
178195
env:
179196
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180197
ACTIONS_STEP_DEBUG: true
181198
with:
182199
title: Skipped Updated test pull request
183-
body: This Skipped updated pull request is part of the CI - please ignore.
200+
body: >-
201+
This Skipped updated pull request is part of the CI - please
202+
ignore.
184203
branch: test-update-pr-title-and-body-${{ github.run_number }}
185-
commit-message: "Just testing [skip ci]"
186-
- run: "echo updated >> test.txt"
204+
commit-message: Just testing [skip ci]
205+
- run: echo updated >> test.txt
187206
- uses: ./
188207
id: run
189208
env:
@@ -193,7 +212,7 @@ jobs:
193212
title: Updated test pull request
194213
body: This updated pull request is part of the CI - please ignore.
195214
branch: test-update-pr-title-and-body-${{ github.run_number }}
196-
commit-message: "Just testing [skip ci]"
215+
commit-message: Just testing [skip ci]
197216
update-pull-request-title-and-body: true
198217
- uses: octokit/request-action@v2.x
199218
id: get-pull-request
@@ -204,22 +223,29 @@ jobs:
204223
pull_number: ${{ steps.run.outputs.pull-request-number }}
205224
env:
206225
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
207-
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-update-pr-title-and-body-${{ github.run_number }}"
226+
- run: >-
227+
git push
228+
https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
229+
:test-update-pr-title-and-body-${{ github.run_number }}
208230
env:
209231
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210-
- if: ${{ fromJson(steps.get-pull-request.outputs.data).title != 'Updated test pull request' }}
211-
run: 'echo "Pull request title is \"${{ fromJson(steps.get-pull-request.outputs.data).title }}\" but expected \"Updated test pull request\"" && exit 1'
212-
232+
- if: >-
233+
${{ fromJson(steps.get-pull-request.outputs.data).title != 'Updated
234+
test pull request' }}
235+
run: >-
236+
echo "Pull request title is \"${{
237+
fromJson(steps.get-pull-request.outputs.data).title }}\" but expected
238+
\"Updated test pull request\"" && exit 1
213239
addReviewers:
214240
name: "[TEST] Add Reviewers"
215241
runs-on: ubuntu-latest
216242
steps:
217-
- uses: actions/checkout@v2
243+
- uses: actions/checkout@v3
218244
with:
219245
persist-credentials: false
220-
- run: "date > test.txt"
221-
- run: "npm ci"
222-
- run: "npm run build"
246+
- run: date > test.txt
247+
- run: npm ci
248+
- run: npm run build
223249
- uses: ./
224250
id: run
225251
env:
@@ -229,7 +255,7 @@ jobs:
229255
title: Test Add Reviewers
230256
body: This pull request is part of the CI - please ignore.
231257
branch: test-add-reviewers-${{ github.run_number }}
232-
commit-message: "Just testing [skip ci]"
258+
commit-message: Just testing [skip ci]
233259
reviewers: gr2m
234260
team_reviewers: test-reviewers
235261
- uses: octokit/request-action@v2.x
@@ -241,8 +267,17 @@ jobs:
241267
pull_number: ${{ steps.run.outputs.pull-request-number }}
242268
env:
243269
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
244-
- run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :test-add-reviewers-${{ github.run_number }}"
270+
- run: >-
271+
git push
272+
https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
273+
:test-add-reviewers-${{ github.run_number }}
245274
env:
246275
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
247-
- if: ${{ !contains(toJson(fromJson(steps.get-pull-request.outputs.data).requested_reviewers.*.login), 'gr2m') }}
248-
run: 'echo "Requested reviewers are \"${{ toJson(fromJson(steps.get-pull-request.outputs.data).requested_reviewers.*.login) }}\" but expected \"[\n gr2m \n]\"" && exit 1'
276+
- if: >-
277+
${{
278+
!contains(toJson(fromJson(steps.get-pull-request.outputs.data).requested_reviewers.*.login),
279+
'gr2m') }}
280+
run: >-
281+
echo "Requested reviewers are \"${{
282+
toJson(fromJson(steps.get-pull-request.outputs.data).requested_reviewers.*.login)
283+
}}\" but expected \"[\n gr2m \n]\"" && exit 1

0 commit comments

Comments
 (0)