Skip to content

Commit 36051c5

Browse files
Merge pull request #39 from endjin/feature/pr-autoflow
Bump Endjin.PRAutoflow from 0.0.0 to 0.1.0 in .github/workflows
2 parents 150895c + 5cf6646 commit 36051c5

File tree

2 files changed

+42
-18
lines changed

2 files changed

+42
-18
lines changed

.github/workflows/auto_release.yml

+31-13
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
steps:
1313
- name: Lookup default branch name
1414
id: lookup_default_branch
15-
uses: actions/github-script@v6
15+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
1616
with:
1717
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
1820
result-encoding: string
1921
script: |
2022
const repo = await github.rest.repos.get({
@@ -28,9 +30,11 @@ jobs:
2830
2931
- name: Lookup HEAD commit on default branch
3032
id: lookup_default_branch_head
31-
uses: actions/github-script@v6
33+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
3234
with:
3335
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
3438
result-encoding: string
3539
script: |
3640
const branch = await github.rest.repos.getBranch({
@@ -50,9 +54,11 @@ jobs:
5054
steps:
5155
- name: Check for 'no_release' label on PR
5256
id: check_for_norelease_label
53-
uses: actions/github-script@v6
57+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5458
with:
5559
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
5662
script: |
5763
const labels = await github.rest.issues.listLabelsOnIssue({
5864
owner: context.payload.repository.owner.login,
@@ -91,9 +97,11 @@ jobs:
9197
steps:
9298
- name: Get Open PRs
9399
id: get_open_pr_list
94-
uses: actions/github-script@v6
100+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
95101
with:
96102
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
97105
# find all open PRs that are targetting the default branch (i.e. main/master)
98106
# return their titles, so they can parsed later to determine if they are
99107
# Dependabot PRs and whether we should wait for them to be auto-merged before
@@ -115,9 +123,11 @@ jobs:
115123
116124
- name: Get 'pending_release' PRs
117125
id: get_release_pending_pr_list
118-
uses: actions/github-script@v6
126+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
119127
with:
120128
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
121131
script: |
122132
const repoWithOwner = `${context.payload.repository.owner.login}/${context.payload.repository.name}`;
123133
const pulls = await github.rest.search.issuesAndPullRequests({
@@ -148,7 +158,7 @@ jobs:
148158
EOF
149159
echo "is_release_pending : ${{ steps.get_release_pending_pr_list.outputs.is_release_pending }}"
150160
151-
- uses: actions/checkout@v3
161+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
152162
- name: Read pr-autoflow configuration
153163
id: get_pr_autoflow_config
154164
uses: endjin/pr-autoflow/actions/read-configuration@v4
@@ -157,8 +167,10 @@ jobs:
157167

158168
- name: Check Human PR
159169
id: is_human_pr
160-
uses: actions/github-script@v6
170+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
161171
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
162174
script: |
163175
return context.payload.pull_request.user.login != 'dependabot[bot]' && context.payload.pull_request.user.login != 'dependjinbot[bot]'
164176
@@ -173,8 +185,10 @@ jobs:
173185

174186
- name: Set Ready for Release
175187
id: set_ready_for_release
176-
uses: actions/github-script@v6
188+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
177189
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
178192
script: |
179193
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'
180194
@@ -193,11 +207,11 @@ jobs:
193207
if: |
194208
needs.check_ready_to_release.outputs.ready_to_release == 'true'
195209
steps:
196-
- uses: actions/setup-dotnet@v1
210+
- uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
197211
with:
198212
dotnet-version: '6.x'
199213

200-
- uses: actions/checkout@v3
214+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
201215
with:
202216
# ensure we are creating the release tag on the default branch
203217
ref: ${{ needs.lookup_default_branch.outputs.branch_name }}
@@ -214,15 +228,17 @@ jobs:
214228
215229
- name: Generate token
216230
id: generate_token
217-
uses: tibdex/github-app-token@v1
231+
uses: tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1.9
218232
with:
219233
app_id: ${{ secrets.ENDJIN_BOT_APP_ID }}
220234
private_key: ${{ secrets.ENDJIN_BOT_PRIVATE_KEY }}
221235

222236
- name: Create SemVer tag
223-
uses: actions/github-script@v6
237+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
224238
with:
225239
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
226242
script: |
227243
const uri_path = '/repos/' + context.payload.repository.owner.login + '/' + context.payload.repository.name + '/git/refs'
228244
const tag = await github.request(('POST ' + uri_path), {
@@ -234,9 +250,11 @@ jobs:
234250
235251
- name: Remove 'release_pending' label from PRs
236252
id: remove_pending_release_labels
237-
uses: actions/github-script@v6
253+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
238254
with:
239255
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
240258
script: |
241259
core.info('PRs to unlabel: ${{ needs.check_ready_to_release.outputs.pending_release_pr_list }}')
242260
const pr_list = JSON.parse('${{ needs.check_ready_to_release.outputs.pending_release_pr_list }}')

.github/workflows/dependabot_approve_and_label.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
is_auto_release_candidate: ${{ steps.parse_dependabot_pr_autorelease.outputs.is_interesting_package }}
2424
semver_increment: ${{ steps.parse_dependabot_pr_automerge.outputs.semver_increment }}
2525
steps:
26-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
2727
- name: Read pr-autoflow configuration
2828
id: get_pr_autoflow_config
2929
uses: endjin/pr-autoflow/actions/read-configuration@v4
@@ -79,9 +79,11 @@ jobs:
7979
if: |
8080
needs.evaluate_dependabot_pr.outputs.is_auto_merge_candidate == 'True' &&
8181
(needs.evaluate_dependabot_pr.outputs.semver_increment == 'minor' || needs.evaluate_dependabot_pr.outputs.semver_increment == 'patch')
82-
uses: actions/github-script@v6
82+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
8383
with:
8484
github-token: '${{ secrets.GITHUB_TOKEN }}'
85+
retries: 6 # final retry should wait 64 seconds
86+
retry-exempt-status-codes: 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
8587
script: |
8688
await github.rest.pulls.update({
8789
owner: context.payload.repository.owner.login,
@@ -97,9 +99,11 @@ jobs:
9799
steps:
98100
- name: Check for 'no_release' label on PR
99101
id: check_for_norelease_label
100-
uses: actions/github-script@v6
102+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
101103
with:
102104
github-token: ${{ secrets.GITHUB_TOKEN }}
105+
retries: 6 # final retry should wait 64 seconds
106+
retry-exempt-status-codes: 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
103107
script: |
104108
const labels = await github.rest.issues.listLabelsOnIssue({
105109
owner: context.payload.repository.owner.login,
@@ -129,7 +133,7 @@ jobs:
129133
# the usual 'Action' secrets as this workflow is triggered by Dependabot.
130134
- name: Generate token
131135
id: generate_token
132-
uses: tibdex/github-app-token@v1
136+
uses: tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1.9
133137
with:
134138
app_id: ${{ secrets.DEPENDJINBOT_APP_ID }}
135139
private_key: ${{ secrets.DEPENDJINBOT_PRIVATE_KEY }}
@@ -150,9 +154,11 @@ jobs:
150154
(github.actor != 'dependabot[bot]' && github.actor != 'dependjinbot[bot]') ||
151155
needs.evaluate_dependabot_pr.outputs.is_auto_release_candidate == 'True'
152156
)
153-
uses: actions/github-script@v6
157+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
154158
with:
155159
github-token: '${{ secrets.GITHUB_TOKEN }}'
160+
retries: 6 # final retry should wait 64 seconds
161+
retry-exempt-status-codes: 400,401,404,422 # GH will raise rate limits with 403 & 429 status codes
156162
script: |
157163
await github.rest.issues.addLabels({
158164
owner: context.payload.repository.owner.login,

0 commit comments

Comments
 (0)