Skip to content

Commit 56195c6

Browse files
Harden release workflow routing
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 5f2d4bf commit 56195c6

4 files changed

Lines changed: 53 additions & 49 deletions

File tree

.github/workflows/Release.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
name: Release
22

3-
run-name: "Release - ${{ github.event_name }} [${{ github.event.pull_request.title || github.event.head_commit.message || github.ref_name }}] by @${{ github.actor }}"
3+
run-name: "Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
44

55
on:
6-
push:
7-
branches:
8-
- main
9-
paths:
10-
- '.github/actions/**'
11-
- '.github/workflows/**'
12-
- '!.github/workflows/Release.yml'
13-
- '!.github/workflows/Linter.yml'
14-
- '!.github/workflows/Workflow-Test-*'
156
pull_request:
167
branches:
178
- main
@@ -29,7 +20,7 @@ on:
2920
- '!.github/workflows/Workflow-Test-*'
3021

3122
concurrency:
32-
group: ${{ github.workflow }}-${{ github.ref }}
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
3324
cancel-in-progress: false
3425

3526
permissions:
@@ -38,7 +29,6 @@ permissions:
3829

3930
jobs:
4031
Release:
41-
if: github.event_name != 'pull_request' || github.event.action != 'closed' || github.event.pull_request.merged == false
4232
runs-on: ubuntu-latest
4333
steps:
4434
- name: Checkout repo

.github/workflows/Workflow-Test-Default.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ on:
1414
- '!.github/workflows/Release.yml'
1515
- '!.github/workflows/Linter.yml'
1616
pull_request:
17+
types:
18+
- closed
19+
- opened
20+
- reopened
21+
- synchronize
22+
- labeled
23+
- unlabeled
1724
paths:
1825
- '.github/actions/**'
1926
- '.github/workflows/**'
@@ -24,8 +31,8 @@ on:
2431
- cron: '0 0 * * *'
2532

2633
concurrency:
27-
group: ${{ github.workflow }}-${{ github.ref }}
28-
cancel-in-progress: true
34+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
35+
cancel-in-progress: false
2936

3037
permissions:
3138
contents: write

.github/workflows/Workflow-Test-WithManifest.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ on:
1414
- '!.github/workflows/Release.yml'
1515
- '!.github/workflows/Linter.yml'
1616
pull_request:
17+
types:
18+
- closed
19+
- opened
20+
- reopened
21+
- synchronize
22+
- labeled
23+
- unlabeled
1724
paths:
1825
- '.github/actions/**'
1926
- '.github/workflows/**'
@@ -24,8 +31,8 @@ on:
2431
- cron: '0 0 * * *'
2532

2633
concurrency:
27-
group: ${{ github.workflow }}-${{ github.ref }}
28-
cancel-in-progress: true
34+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
35+
cancel-in-progress: false
2936

3037
permissions:
3138
contents: write

.github/workflows/workflow.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ permissions:
7676
id-token: write # to verify the deployment originates from an appropriate source
7777

7878
concurrency:
79-
group: ${{ github.workflow }}-${{ github.ref }}
79+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8080
cancel-in-progress: false
8181

8282
jobs:
8383
# Runs on:
8484
# - ✅ Open/Updated PR - Always runs to load configuration
85-
# - ✅ Merged PR - Always runs to load configuration
86-
# - ✅ Abandoned PR - Always runs to load configuration
85+
# - ✅ Default push - Always runs to load configuration
86+
# - ✅ Closed PR - Always runs to load configuration
8787
# - ✅ Manual run - Always runs to load configuration
8888
Plan:
8989
uses: ./.github/workflows/Plan.yml
@@ -101,8 +101,8 @@ jobs:
101101

102102
# Runs on:
103103
# - ✅ Open/Updated PR - Lints code changes in active PRs
104-
# - ❌ Merged PR - No need to lint after merge + its a merge commit that causes issues with super-linter
105-
# - ❌ Abandoned PR - No need to lint abandoned changes
104+
# - ❌ Default push - No need to lint after merge + its a merge commit that causes issues with super-linter
105+
# - ❌ Closed PR - No need to lint closed changes
106106
# - ❌ Manual run - Only runs for PR events
107107
Lint-Repository:
108108
if: fromJson(needs.Plan.outputs.Settings).Linter.Repository.Enabled
@@ -114,8 +114,8 @@ jobs:
114114

115115
# Runs on:
116116
# - ✅ Open/Updated PR - Builds module for testing
117-
# - ✅ Merged PR - Builds module for publishing
118-
# - ❌ Abandoned PR - Skips building abandoned changes
117+
# - ✅ Default push - Builds module for publishing
118+
# - ❌ Closed PR - Skips building closed changes
119119
# - ✅ Manual run - Builds module when manually triggered
120120
Build-Module:
121121
if: fromJson(needs.Plan.outputs.Settings).Build.Module.Enabled
@@ -130,8 +130,8 @@ jobs:
130130

131131
# Runs on:
132132
# - ✅ Open/Updated PR - Tests source code changes
133-
# - ✅ Merged PR - Tests source code before publishing
134-
# - ❌ Abandoned PR - Skips testing abandoned changes
133+
# - ✅ Default push - Tests source code before publishing
134+
# - ❌ Closed PR - Skips testing closed changes
135135
# - ✅ Manual run - Tests source code when manually triggered
136136
Test-SourceCode:
137137
if: fromJson(needs.Plan.outputs.Settings).Test.SourceCode.Enabled
@@ -143,8 +143,8 @@ jobs:
143143

144144
# Runs on:
145145
# - ✅ Open/Updated PR - Lints source code changes
146-
# - ✅ Merged PR - Lints source code before publishing
147-
# - ❌ Abandoned PR - Skips linting abandoned changes
146+
# - ✅ Default push - Lints source code before publishing
147+
# - ❌ Closed PR - Skips linting closed changes
148148
# - ✅ Manual run - Lints source code when manually triggered
149149
Lint-SourceCode:
150150
if: fromJson(needs.Plan.outputs.Settings).Linter.SourceCode.Enabled
@@ -156,8 +156,8 @@ jobs:
156156

157157
# Runs on:
158158
# - ✅ Open/Updated PR - Tests built module
159-
# - ✅ Merged PR - Tests built module before publishing
160-
# - ❌ Abandoned PR - Skips testing abandoned changes
159+
# - ✅ Default push - Tests built module before publishing
160+
# - ❌ Closed PR - Skips testing closed changes
161161
# - ✅ Manual run - Tests built module when manually triggered
162162
Test-Module:
163163
if: fromJson(needs.Plan.outputs.Settings).Test.PSModule.Enabled && needs.Build-Module.result == 'success' && !cancelled()
@@ -170,8 +170,8 @@ jobs:
170170

171171
# Runs on:
172172
# - ✅ Open/Updated PR - Runs setup scripts before local module tests
173-
# - ✅ Merged PR - Runs setup scripts before local module tests
174-
# - ❌ Abandoned PR - Skips setup for abandoned changes
173+
# - ✅ Default push - Runs setup scripts before local module tests
174+
# - ❌ Closed PR - Skips setup for closed changes
175175
# - ✅ Manual run - Runs setup scripts when manually triggered
176176
BeforeAll-ModuleLocal:
177177
if: fromJson(needs.Plan.outputs.Settings).Test.Module.BeforeAllEnabled && needs.Build-Module.result == 'success' && !cancelled()
@@ -186,8 +186,8 @@ jobs:
186186

187187
# Runs on:
188188
# - ✅ Open/Updated PR - Tests module in local environment
189-
# - ✅ Merged PR - Tests module in local environment before publishing
190-
# - ❌ Abandoned PR - Skips testing abandoned changes
189+
# - ✅ Default push - Tests module in local environment before publishing
190+
# - ❌ Closed PR - Skips testing closed changes
191191
# - ✅ Manual run - Tests module in local environment when manually triggered
192192
Test-ModuleLocal:
193193
if: fromJson(needs.Plan.outputs.Settings).Test.Module.MainEnabled && needs.Build-Module.result == 'success' && !cancelled()
@@ -203,8 +203,8 @@ jobs:
203203

204204
# Runs on:
205205
# - ✅ Open/Updated PR - Runs teardown scripts after local module setup/tests
206-
# - ✅ Merged PR - Runs teardown scripts after local module setup/tests
207-
# - ✅ Abandoned PR - Runs teardown if local module setup/tests were started (cleanup)
206+
# - ✅ Default push - Runs teardown scripts after local module setup/tests
207+
# - ❌ Closed PR - No test setup ran in the closed-PR cleanup path
208208
# - ✅ Manual run - Runs teardown scripts after local module setup/tests
209209
AfterAll-ModuleLocal:
210210
if: fromJson(needs.Plan.outputs.Settings).Test.Module.AfterAllEnabled && needs.BeforeAll-ModuleLocal.result != 'skipped' && always()
@@ -220,8 +220,8 @@ jobs:
220220

221221
# Runs on:
222222
# - ✅ Open/Updated PR - Collects and reports test results
223-
# - ✅ Merged PR - Collects and reports test results before publishing
224-
# - ❌ Abandoned PR - Skips collecting results for abandoned changes
223+
# - ✅ Default push - Collects and reports test results before publishing
224+
# - ❌ Closed PR - Skips collecting results for closed changes
225225
# - ✅ Manual run - Collects and reports test results when manually triggered
226226
Get-TestResults:
227227
if: fromJson(needs.Plan.outputs.Settings).Test.TestResults.Enabled && needs.Plan.result == 'success' && always() && !cancelled()
@@ -239,8 +239,8 @@ jobs:
239239

240240
# Runs on:
241241
# - ✅ Open/Updated PR - Calculates and reports code coverage
242-
# - ✅ Merged PR - Calculates and reports code coverage before publishing
243-
# - ❌ Abandoned PR - Skips coverage for abandoned changes
242+
# - ✅ Default push - Calculates and reports code coverage before publishing
243+
# - ❌ Closed PR - Skips coverage for closed changes
244244
# - ✅ Manual run - Calculates and reports code coverage when manually triggered
245245
Get-CodeCoverage:
246246
if: fromJson(needs.Plan.outputs.Settings).Test.CodeCoverage.Enabled && needs.Plan.result == 'success' && always() && !cancelled()
@@ -254,9 +254,9 @@ jobs:
254254

255255
# Runs on:
256256
# - ✅ Open/Updated PR - Only with prerelease label: publishes prerelease version
257-
# - ✅ Merged PR - To default branch only: publishes release when all tests/coverage/build succeed
258-
# - ✅ Abandoned PR - Cleans up prereleases for the abandoned branch (no version published)
259-
# - Manual run - Only runs for PR events
257+
# - ✅ Default push - Publishes a stable release when all tests/coverage/build succeed
258+
# - ✅ Closed PR - Cleans up prereleases for the closed branch (no version published)
259+
# - Manual run - Publishes a stable default-branch release
260260
Publish-Module:
261261
if: fromJson(needs.Plan.outputs.Settings).Publish.Module.Enabled && needs.Plan.result == 'success' && !cancelled() && (needs.Get-TestResults.result == 'success' || needs.Get-TestResults.result == 'skipped') && (needs.Get-CodeCoverage.result == 'success' || needs.Get-CodeCoverage.result == 'skipped') && (needs.Build-Site.result == 'success' || needs.Build-Site.result == 'skipped')
262262
uses: ./.github/workflows/Publish-Module.yml
@@ -274,8 +274,8 @@ jobs:
274274

275275
# Runs on:
276276
# - ✅ Open/Updated PR - Builds documentation for review
277-
# - ✅ Merged PR - Builds documentation for publishing
278-
# - ❌ Abandoned PR - Skips building docs for abandoned changes
277+
# - ✅ Default push - Builds documentation for publishing
278+
# - ❌ Closed PR - Skips building docs for closed changes
279279
# - ✅ Manual run - Builds documentation when manually triggered
280280
Build-Docs:
281281
if: fromJson(needs.Plan.outputs.Settings).Build.Docs.Enabled
@@ -288,8 +288,8 @@ jobs:
288288

289289
# Runs on:
290290
# - ✅ Open/Updated PR - Builds site for preview
291-
# - ✅ Merged PR - Builds site for publishing
292-
# - ❌ Abandoned PR - Skips building site for abandoned changes
291+
# - ✅ Default push - Builds site for publishing
292+
# - ❌ Closed PR - Skips building site for closed changes
293293
# - ✅ Manual run - Builds site when manually triggered
294294
Build-Site:
295295
if: fromJson(needs.Plan.outputs.Settings).Build.Site.Enabled
@@ -302,9 +302,9 @@ jobs:
302302

303303
# Runs on:
304304
# - ❌ Open/Updated PR - Site not published for PRs in progress
305-
# - ✅ Merged PR - To default branch only: deploys site to GitHub Pages
306-
# - ❌ Abandoned PR - Site not published for abandoned changes
307-
# - Manual run - Only publishes on merged PRs to default branch
305+
# - ✅ Default push - Deploys site to GitHub Pages unless publication is skipped
306+
# - ❌ Closed PR - Site not published for closed changes
307+
# - Manual run - Publishes from a default-branch stable release
308308
Publish-Site:
309309
if: fromJson(needs.Plan.outputs.Settings).Publish.Site.Enabled && needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled()
310310
uses: ./.github/workflows/Publish-Site.yml

0 commit comments

Comments
 (0)