Skip to content

Commit dca723f

Browse files
claudetylerslaton
authored andcommitted
feat(ci): add workflow_dispatch escape hatch to release/publish
Adds a manual workflow_dispatch trigger so the release/publish workflow can be re-run against the latest commit on main when the normal flow (merge a release/publish/* PR) is unavailable — e.g. after a failed release that already bumped versions on main but did not publish. Scope of coverage: - Covers failures BEFORE the "Publish to npm" step succeeds (build errors, infra blips, git config bugs). - Does NOT cover post-npm-publish failures: if npm publish already succeeded but a later step failed, the dispatch retry will fail at "Publish to npm" with "already published", and the "Check for pre-existing tags" step will block retries where the tag was pushed. Those cases need manual remediation using release-notes.md from the merged release PR. Both the in-file YAML comment and the dispatch form's scope input description spell this out so operators see it before triggering.
1 parent 98c1a52 commit dca723f

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

.github/workflows/publish-release.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ on:
44
pull_request:
55
types: [closed]
66
branches: [main]
7+
# Escape hatch for failed releases. Covers failures BEFORE the "Publish to
8+
# npm" step succeeds (build errors, infra blips, git config bugs). Does
9+
# NOT cover post-npm-publish failures: if npm publish already succeeded
10+
# but a later step failed, the retry will fail at "Publish to npm" with
11+
# an "already published" error, and the "Check for pre-existing tags"
12+
# step will also block retries where the tag was pushed. For those cases,
13+
# remediate by hand using release-notes.md from the merged release PR.
14+
workflow_dispatch:
15+
inputs:
16+
scope:
17+
description: |
18+
⚠️ MANUAL RETRIGGER — republishes from the latest commit on main,
19+
bypassing the normal release-PR flow. Only use this when the
20+
normal flow failed BEFORE npm publish succeeded. If npm publish
21+
already happened, finish the release by hand instead — dispatching
22+
here will fail at "Publish to npm" with "already published".
23+
required: true
24+
type: choice
25+
options:
26+
- monorepo
27+
- angular
728

829
permissions:
930
contents: read
@@ -17,23 +38,28 @@ env:
1738

1839
jobs:
1940
build:
20-
# Only run when a release PR is merged (not just closed)
41+
# Run on a merged release PR (normal flow) or a manual workflow_dispatch (escape hatch).
2142
if: >
22-
github.event.pull_request.merged == true &&
23-
startsWith(github.event.pull_request.head.ref, 'release/publish/')
43+
github.event_name == 'workflow_dispatch' ||
44+
(github.event.pull_request.merged == true &&
45+
startsWith(github.event.pull_request.head.ref, 'release/publish/'))
2446
runs-on: ubuntu-latest
2547
timeout-minutes: 20
2648
permissions:
2749
contents: read
2850
steps:
29-
- name: Extract scope from branch
51+
- name: Determine scope
3052
id: meta
3153
env:
3254
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
55+
INPUT_SCOPE: ${{ inputs.scope }}
3356
run: |
34-
BRANCH="${PR_HEAD_REF}"
35-
# Branch format: release/publish/<scope>/v<version>
36-
SCOPE=$(echo "$BRANCH" | sed 's|release/publish/\([^/]*\)/v.*|\1|')
57+
if [ -n "$INPUT_SCOPE" ]; then
58+
SCOPE="$INPUT_SCOPE"
59+
else
60+
# Branch format: release/publish/<scope>/v<version>
61+
SCOPE=$(echo "$PR_HEAD_REF" | sed 's|release/publish/\([^/]*\)/v.*|\1|')
62+
fi
3763
echo "scope=$SCOPE" >> $GITHUB_OUTPUT
3864
echo "Detected scope: $SCOPE"
3965

0 commit comments

Comments
 (0)