12
12
steps :
13
13
- name : Lookup default branch name
14
14
id : lookup_default_branch
15
- uses : actions/github-script@v6
15
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
16
16
with :
17
17
github-token : ${{ secrets.GITHUB_TOKEN }}
18
+ retries : 6 # final retry should wait 64 seconds
19
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
18
20
result-encoding : string
19
21
script : |
20
22
const repo = await github.rest.repos.get({
28
30
29
31
- name : Lookup HEAD commit on default branch
30
32
id : lookup_default_branch_head
31
- uses : actions/github-script@v6
33
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
32
34
with :
33
35
github-token : ${{ secrets.GITHUB_TOKEN }}
36
+ retries : 6 # final retry should wait 64 seconds
37
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
34
38
result-encoding : string
35
39
script : |
36
40
const branch = await github.rest.repos.getBranch({
50
54
steps :
51
55
- name : Check for 'no_release' label on PR
52
56
id : check_for_norelease_label
53
- uses : actions/github-script@v6
57
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
54
58
with :
55
59
github-token : ${{ secrets.GITHUB_TOKEN }}
60
+ retries : 6 # final retry should wait 64 seconds
61
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
56
62
script : |
57
63
const labels = await github.rest.issues.listLabelsOnIssue({
58
64
owner: context.payload.repository.owner.login,
62
68
core.info("labels: " + JSON.stringify(labels.data))
63
69
if ( labels.data.map(l => l.name).includes("no_release") ) {
64
70
core.info("Label found")
71
+ if ( labels.data.map(l => l.name).includes("pending_release") ) {
72
+ // Remove the 'pending_release' label
73
+ await github.rest.issues.removeLabel({
74
+ owner: context.payload.repository.owner.login,
75
+ repo: context.payload.repository.name,
76
+ issue_number: context.payload.pull_request.number,
77
+ name: 'pending_release'
78
+ })
79
+ }
80
+
65
81
return true
66
82
}
67
83
return false
81
97
steps :
82
98
- name : Get Open PRs
83
99
id : get_open_pr_list
84
- uses : actions/github-script@v6
100
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
85
101
with :
86
102
github-token : ${{ secrets.GITHUB_TOKEN }}
103
+ retries : 6 # final retry should wait 64 seconds
104
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
87
105
# find all open PRs that are targetting the default branch (i.e. main/master)
88
106
# return their titles, so they can parsed later to determine if they are
89
107
# Dependabot PRs and whether we should wait for them to be auto-merged before
@@ -105,9 +123,11 @@ jobs:
105
123
106
124
- name : Get 'pending_release' PRs
107
125
id : get_release_pending_pr_list
108
- uses : actions/github-script@v6
126
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
109
127
with :
110
128
github-token : ${{ secrets.GITHUB_TOKEN }}
129
+ retries : 6 # final retry should wait 64 seconds
130
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
111
131
script : |
112
132
const repoWithOwner = `${context.payload.repository.owner.login}/${context.payload.repository.name}`;
113
133
const pulls = await github.rest.search.issuesAndPullRequests({
@@ -118,11 +138,13 @@ jobs:
118
138
119
139
releasePendingPrDetails = pulls.data.items.
120
140
filter(function (x) { return x.labels.map(l=>l.name).includes('pending_release') }).
141
+ filter(function (x) { return !x.labels.map(l=>l.name).includes('no_release') }).
121
142
map(p=>`#${p.number} '${p.title}' in ${p.repository_url}`);
122
143
core.info(`releasePendingPrDetails: ${JSON.stringify(releasePendingPrDetails)}`);
123
144
124
145
const release_pending_prs = pulls.data.items.
125
146
filter(function (x) { return x.labels.map(l=>l.name).includes('pending_release') }).
147
+ filter(function (x) { return !x.labels.map(l=>l.name).includes('no_release') }).
126
148
map(p=>p.number);
127
149
core.info(`release_pending_prs: ${JSON.stringify(release_pending_prs)}`);
128
150
core.setOutput('is_release_pending', (release_pending_prs.length > 0));
@@ -136,7 +158,7 @@ jobs:
136
158
EOF
137
159
echo "is_release_pending : ${{ steps.get_release_pending_pr_list.outputs.is_release_pending }}"
138
160
139
- - uses : actions/checkout@v3
161
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
140
162
- name : Read pr-autoflow configuration
141
163
id : get_pr_autoflow_config
142
164
uses : endjin/pr-autoflow/actions/read-configuration@v4
@@ -145,8 +167,10 @@ jobs:
145
167
146
168
- name : Check Human PR
147
169
id : is_human_pr
148
- uses : actions/github-script@v6
170
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
149
171
with :
172
+ retries : 6 # final retry should wait 64 seconds
173
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
150
174
script : |
151
175
return context.payload.pull_request.user.login != 'dependabot[bot]' && context.payload.pull_request.user.login != 'dependjinbot[bot]'
152
176
@@ -161,10 +185,12 @@ jobs:
161
185
162
186
- name : Set Ready for Release
163
187
id : set_ready_for_release
164
- uses : actions/github-script@v6
188
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
165
189
with :
190
+ retries : 6 # final retry should wait 64 seconds
191
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
166
192
script : |
167
- return ( '${{ steps.is_human_pr.outputs.result }}' == 'True ' || '${{ steps.watch_dependabot_prs.outputs.is_complete }}' == 'True') && '${{ steps.get_release_pending_pr_list.outputs.is_release_pending }}' == 'True '
193
+ return ( '${{ steps.is_human_pr.outputs.result }}' == 'true ' || '${{ steps.watch_dependabot_prs.outputs.is_complete }}' == 'True') && '${{ steps.get_release_pending_pr_list.outputs.is_release_pending }}' == 'true '
168
194
169
195
- name : Display job outputs
170
196
run : |
@@ -181,11 +207,11 @@ jobs:
181
207
if : |
182
208
needs.check_ready_to_release.outputs.ready_to_release == 'true'
183
209
steps :
184
- - uses : actions/setup-dotnet@v1
210
+ - uses : actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
185
211
with :
186
212
dotnet-version : ' 6.x'
187
213
188
- - uses : actions/checkout@v3
214
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
189
215
with :
190
216
# ensure we are creating the release tag on the default branch
191
217
ref : ${{ needs.lookup_default_branch.outputs.branch_name }}
@@ -199,33 +225,36 @@ jobs:
199
225
id : run_gitversion
200
226
run : |
201
227
pwsh -noprofile -c 'dotnet-gitversion /diag'
202
- pwsh -noprofile -c '(dotnet-gitversion | ConvertFrom-Json).psobject.properties | % { echo ("{0}={1}" -f $_.name, $_.value) >> $GITHUB_OUTPUT }'
203
228
204
229
- name : Generate token
205
230
id : generate_token
206
- uses : tibdex/github-app-token@v1
231
+ uses : tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1.9
207
232
with :
208
233
app_id : ${{ secrets.ENDJIN_BOT_APP_ID }}
209
234
private_key : ${{ secrets.ENDJIN_BOT_PRIVATE_KEY }}
210
235
211
236
- name : Create SemVer tag
212
- uses : actions/github-script@v6
237
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
213
238
with :
214
239
github-token : ${{ steps.generate_token.outputs.token }}
240
+ retries : 6 # final retry should wait 64 seconds
241
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
215
242
script : |
216
243
const uri_path = '/repos/' + context.payload.repository.owner.login + '/' + context.payload.repository.name + '/git/refs'
217
244
const tag = await github.request(('POST ' + uri_path), {
218
245
owner: context.payload.repository.owner.login,
219
246
repo: context.payload.repository.name,
220
- ref: 'refs/tags/${{ steps.run_gitversion.outputs.MajorMinorPatch }}',
247
+ ref: 'refs/tags/${{ env.GitVersion_MajorMinorPatch }}',
221
248
sha: '${{ needs.lookup_default_branch.outputs.head_commit }}'
222
249
})
223
250
224
251
- name : Remove 'release_pending' label from PRs
225
252
id : remove_pending_release_labels
226
- uses : actions/github-script@v6
253
+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
227
254
with :
228
255
github-token : ' ${{ steps.generate_token.outputs.token }}'
256
+ retries : 6 # final retry should wait 64 seconds
257
+ retry-exempt-status-codes : 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
229
258
script : |
230
259
core.info('PRs to unlabel: ${{ needs.check_ready_to_release.outputs.pending_release_pr_list }}')
231
260
const pr_list = JSON.parse('${{ needs.check_ready_to_release.outputs.pending_release_pr_list }}')
0 commit comments