Skip to content

Commit 2cbb745

Browse files
Update codeops files (#222)
1 parent f233f67 commit 2cbb745

File tree

6 files changed

+99
-59
lines changed

6 files changed

+99
-59
lines changed

.github/workflows/auto_release.yml

+45-16
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,
@@ -62,6 +68,16 @@ jobs:
6268
core.info("labels: " + JSON.stringify(labels.data))
6369
if ( labels.data.map(l => l.name).includes("no_release") ) {
6470
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+
6581
return true
6682
}
6783
return false
@@ -81,9 +97,11 @@ jobs:
8197
steps:
8298
- name: Get Open PRs
8399
id: get_open_pr_list
84-
uses: actions/github-script@v6
100+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
85101
with:
86102
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
87105
# find all open PRs that are targetting the default branch (i.e. main/master)
88106
# return their titles, so they can parsed later to determine if they are
89107
# Dependabot PRs and whether we should wait for them to be auto-merged before
@@ -105,9 +123,11 @@ jobs:
105123
106124
- name: Get 'pending_release' PRs
107125
id: get_release_pending_pr_list
108-
uses: actions/github-script@v6
126+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
109127
with:
110128
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
111131
script: |
112132
const repoWithOwner = `${context.payload.repository.owner.login}/${context.payload.repository.name}`;
113133
const pulls = await github.rest.search.issuesAndPullRequests({
@@ -118,11 +138,13 @@ jobs:
118138
119139
releasePendingPrDetails = pulls.data.items.
120140
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') }).
121142
map(p=>`#${p.number} '${p.title}' in ${p.repository_url}`);
122143
core.info(`releasePendingPrDetails: ${JSON.stringify(releasePendingPrDetails)}`);
123144
124145
const release_pending_prs = pulls.data.items.
125146
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') }).
126148
map(p=>p.number);
127149
core.info(`release_pending_prs: ${JSON.stringify(release_pending_prs)}`);
128150
core.setOutput('is_release_pending', (release_pending_prs.length > 0));
@@ -136,7 +158,7 @@ jobs:
136158
EOF
137159
echo "is_release_pending : ${{ steps.get_release_pending_pr_list.outputs.is_release_pending }}"
138160
139-
- uses: actions/checkout@v3
161+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
140162
- name: Read pr-autoflow configuration
141163
id: get_pr_autoflow_config
142164
uses: endjin/pr-autoflow/actions/read-configuration@v4
@@ -145,8 +167,10 @@ jobs:
145167

146168
- name: Check Human PR
147169
id: is_human_pr
148-
uses: actions/github-script@v6
170+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
149171
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
150174
script: |
151175
return context.payload.pull_request.user.login != 'dependabot[bot]' && context.payload.pull_request.user.login != 'dependjinbot[bot]'
152176
@@ -161,10 +185,12 @@ jobs:
161185

162186
- name: Set Ready for Release
163187
id: set_ready_for_release
164-
uses: actions/github-script@v6
188+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
165189
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
166192
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'
168194
169195
- name: Display job outputs
170196
run: |
@@ -181,11 +207,11 @@ jobs:
181207
if: |
182208
needs.check_ready_to_release.outputs.ready_to_release == 'true'
183209
steps:
184-
- uses: actions/setup-dotnet@v1
210+
- uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
185211
with:
186212
dotnet-version: '6.x'
187213

188-
- uses: actions/checkout@v3
214+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
189215
with:
190216
# ensure we are creating the release tag on the default branch
191217
ref: ${{ needs.lookup_default_branch.outputs.branch_name }}
@@ -199,33 +225,36 @@ jobs:
199225
id: run_gitversion
200226
run: |
201227
pwsh -noprofile -c 'dotnet-gitversion /diag'
202-
pwsh -noprofile -c '(dotnet-gitversion | ConvertFrom-Json).psobject.properties | % { echo ("{0}={1}" -f $_.name, $_.value) >> $GITHUB_OUTPUT }'
203228
204229
- name: Generate token
205230
id: generate_token
206-
uses: tibdex/github-app-token@v1
231+
uses: tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1.9
207232
with:
208233
app_id: ${{ secrets.ENDJIN_BOT_APP_ID }}
209234
private_key: ${{ secrets.ENDJIN_BOT_PRIVATE_KEY }}
210235

211236
- name: Create SemVer tag
212-
uses: actions/github-script@v6
237+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
213238
with:
214239
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
215242
script: |
216243
const uri_path = '/repos/' + context.payload.repository.owner.login + '/' + context.payload.repository.name + '/git/refs'
217244
const tag = await github.request(('POST ' + uri_path), {
218245
owner: context.payload.repository.owner.login,
219246
repo: context.payload.repository.name,
220-
ref: 'refs/tags/${{ steps.run_gitversion.outputs.MajorMinorPatch }}',
247+
ref: 'refs/tags/${{ env.GitVersion_MajorMinorPatch }}',
221248
sha: '${{ needs.lookup_default_branch.outputs.head_commit }}'
222249
})
223250
224251
- name: Remove 'release_pending' label from PRs
225252
id: remove_pending_release_labels
226-
uses: actions/github-script@v6
253+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
227254
with:
228255
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
229258
script: |
230259
core.info('PRs to unlabel: ${{ needs.check_ready_to_release.outputs.pending_release_pr_list }}')
231260
const pr_list = JSON.parse('${{ needs.check_ready_to_release.outputs.pending_release_pr_list }}')

.github/workflows/build.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ jobs:
4646
id: prepareEnvVarsAndSecrets
4747
with:
4848
environmentVariablesYaml: |
49-
BUILDVAR_NuGetPublishSource: "${{ startsWith(github.ref, 'refs/tags/') && 'https://api.nuget.org/v3/index.json' || 'https://nuget.pkg.github.com/endjin/index.json' }}"
49+
{}
5050
secretsYaml: |
51-
NUGET_API_KEY: "${{ startsWith(github.ref, 'refs/tags/') && secrets.ENDJIN_NUGET_APIKEY || secrets.ENDJIN_GITHUB_PUBLISHER_PAT }}"
51+
{
52+
NUGET_API_KEY: "${{ secrets.GITHUB_TOKEN }}"
53+
}
5254
5355
build:
5456
needs: prepareConfig

.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,

GitVersion.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# DO NOT EDIT THIS FILE
22
# This file was generated by the pr-autoflow mechanism as a result of executing this action:
3-
# https://github.com/endjin/.github/actions/workflows/deploy_pr_autoflow.yml
4-
# This repository participates in this mechanism due to an entry in this file:
5-
# https://github.com/endjin/.github/blob/b69ff1d66541ae049fb0457c65c719c6d7e9b862/repos/live/corvus-dotnet.yml
3+
# https://github.com/endjin/endjin-codeops/actions/workflows/deploy_pr_autoflow.yml
4+
# This repository participates in this mechanism due to an entry in one of these files:
5+
# https://github.com/endjin/endjin-codeops/blob/main/repo-level-processes/config/live
66

77
mode: ContinuousDeployment
88
branches:

Solutions/Stacker.Cli/packages.lock.json

+3-17
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,6 @@
115115
"resolved": "0.18.0",
116116
"contentHash": "FCh6hQMOyMgL/bk0BPpXUkHNT+bXNHfSgLyFQ8X3Fca1HwxMtCMVK0kg2YYuwnN9F36+Ru8AqtzBaHRWMkj7cA=="
117117
},
118-
"StyleCop.Analyzers": {
119-
"type": "Direct",
120-
"requested": "[1.2.0-beta.556, )",
121-
"resolved": "1.2.0-beta.556",
122-
"contentHash": "llRPgmA1fhC0I0QyFLEcjvtM2239QzKr/tcnbsjArLMJxJlu0AA5G7Fft0OI30pHF3MW63Gf4aSSsjc5m82J1Q==",
123-
"dependencies": {
124-
"StyleCop.Analyzers.Unstable": "1.2.0.556"
125-
}
126-
},
127118
"System.Threading.Tasks.Dataflow": {
128119
"type": "Direct",
129120
"requested": "[8.0.1, )",
@@ -289,15 +280,10 @@
289280
"resolved": "0.49.1",
290281
"contentHash": "USV+pdu49OJ3nCjxNuw1K9Zw/c1HCBbwbjXZp0EOn6wM99tFdAtN34KEBZUMyRuJuXlUMDqhd8Yq9obW2MslYA=="
291282
},
292-
"StyleCop.Analyzers.Unstable": {
283+
"System.Memory": {
293284
"type": "Transitive",
294-
"resolved": "1.2.0.556",
295-
"contentHash": "zvn9Mqs/ox/83cpYPignI8hJEM2A93s2HkHs8HYMOAQW0PkampyoErAiIyKxgTLqbbad29HX/shv/6LGSjPJNQ=="
296-
},
297-
"System.Diagnostics.DiagnosticSource": {
298-
"type": "Transitive",
299-
"resolved": "8.0.0",
300-
"contentHash": "c9xLpVz6PL9lp/djOWtk5KPDZq3cSYpmXoJQY524EOtuFl5z9ZtsotpsyrDW40U1DRnQSYvcPKEUV0X//u6gkQ=="
285+
"resolved": "4.5.5",
286+
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw=="
301287
},
302288
"System.Runtime.CompilerServices.Unsafe": {
303289
"type": "Transitive",

build.ps1

+33-16
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ param (
7676
[Parameter()]
7777
[string] $BuildModulePackageVersion = $BuildModuleVersion,
7878

79-
[Parameter()]
80-
[bool] $BuildModuleAllowPreRelease = $false,
81-
8279
[Parameter()]
8380
[version] $InvokeBuildModuleVersion = "5.10.3"
8481
)
@@ -110,8 +107,8 @@ if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
110107
#region Import shared tasks and initialise build framework
111108
if (!($BuildModulePath)) {
112109
if (!(Get-Module -ListAvailable Endjin.RecommendedPractices.Build | ? { $_.Version -eq $BuildModuleVersion })) {
113-
Write-Information "Installing 'Endjin.RecommendedPractices.Build' module... [PackageVersion=$BuildModulePackageVersion]"
114-
Install-Module Endjin.RecommendedPractices.Build -RequiredVersion $BuildModulePackageVersion -Scope CurrentUser -Force -Repository PSGallery -AllowPrerelease:$BuildModuleAllowPreRelease
110+
Write-Information "Installing 'Endjin.RecommendedPractices.Build' module..."
111+
Install-Module Endjin.RecommendedPractices.Build -RequiredVersion $BuildModulePackageVersion -Scope CurrentUser -Force -Repository PSGallery -AllowPrerelease
115112
}
116113
$BuildModulePath = "Endjin.RecommendedPractices.Build"
117114
}
@@ -136,7 +133,6 @@ $SkipTest = $false
136133
$SkipTestReport = $false
137134
$SkipAnalysis = $false
138135
$SkipPackage = $false
139-
$SkipPublish = $false
140136

141137

142138
#
@@ -158,12 +154,6 @@ $NuSpecFilesToPackage = @(
158154
#
159155
$ExcludeFilesFromCodeCoverage = ""
160156

161-
# Enable GitHub release functionality
162-
$CreateGitHubRelease = $true
163-
$GitHubReleaseArtefacts = @()
164-
$PublishNuGetPackagesAsGitHubReleaseArtefacts = $true
165-
166-
167157
# Synopsis: Build, Test and Package
168158
task . FullBuild
169159

@@ -181,10 +171,37 @@ task PostTest {}
181171
task PreTestReport {}
182172
task PostTestReport {}
183173
task PreAnalysis {}
184-
task PostAnalysis {}
174+
task PostAnalysis
185175
task PrePackage {}
186176
task PostPackage {}
187-
task PrePublish {}
188-
task PostPublish {}
177+
task PrePublish {
178+
# workaround
179+
if (!(Test-Path "$here/_local-nuget-feed")) { New-Item -ItemType Directory "$here/_local-nuget-feed" | Out-Null }
180+
}
181+
task PostPublish {
182+
# Publish NuGet packages as GitHub release artefacts
183+
$evaluatedNugetPackagesToPublishGlob = Invoke-Expression "`"$($NugetPackageNamesToPublishGlob)$($NugetPackagesToPublishGlobSuffix)`""
184+
Write-Host "evaluatedNugetPackagesToPublishGlob: $evaluatedNugetPackagesToPublishGlob"
185+
$nugetPackagesToPublish = Get-ChildItem -Path "$here/_packages" -Filter $evaluatedNugetPackagesToPublishGlob
186+
Write-Host "nugetPackagesToPublish: $nugetPackagesToPublish"
187+
188+
if ($nugetPackagesToPublish) {
189+
$existingRelease = exec { gh release list } |
190+
ConvertFrom-Csv -Delimiter "`t" -Header @("TITLE","TYPE","TAG NAME","PUBLISHED") |
191+
Where-Object { $_."TAG NAME" -eq $GitVersion.SemVer }
192+
193+
if (!$existingRelease) {
194+
Write-Host "Creating release"
195+
exec { & gh release create $($GitVersion.SemVer) --generate-notes }
196+
}
197+
else {
198+
Write-Host "Updating existing release"
199+
}
200+
201+
foreach ($nugetPackage in $nugetPackagesToPublish) {
202+
Write-Host "Uploading: $(Split-Path -Leaf $nugetPackage)"
203+
exec { & gh release upload --clobber $($GitVersion.SemVer) $nugetPackage }
204+
}
205+
}
206+
}
189207
task RunLast {}
190-

0 commit comments

Comments
 (0)