Skip to content

Commit bcc1707

Browse files
patocallaghanclaude
andcommitted
Harden publish workflow: fix ancestry guard, serialize releases, bound runtime
Apply the fixes validated on the passport-intercom and cli publish workflows: - verify: use fetch-depth: 0 and drop the manual `git fetch --depth=1`, so the default-branch ancestry check has the history it needs (the double-shallow version could only pass when the tag was the branch tip) - add a top-level concurrency group so overlapping releases serialize instead of racing for a dist-tag - add timeout-minutes: 15 to stage-publish Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b3e9ad9 commit bcc1707

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ on:
77
permissions:
88
contents: read # workflow default (least privilege); only stage-publish also needs id-token, granted on that job
99

10+
concurrency:
11+
group: publish-${{ github.workflow }} # serialize all publish runs; never two staged releases racing for a dist-tag
12+
cancel-in-progress: false # queue, don't cancel: killing a half-done `npm stage publish` is the torn state we're avoiding
13+
1014
jobs:
1115
verify:
1216
runs-on: ubuntu-latest
1317
steps:
1418
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15-
with: { persist-credentials: false }
19+
with:
20+
persist-credentials: false
21+
fetch-depth: 0 # full history so origin/<default> ancestry is computable; checkout fetches authenticated before stripping creds
1622
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
1723
with:
1824
node-version-file: '.nvmrc' # pin >= 22.14.0
@@ -28,13 +34,13 @@ jobs:
2834
RELEASE_TAG: ${{ github.event.release.tag_name }}
2935
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
3036
run: |
31-
git fetch origin "$DEFAULT_BRANCH" --depth=1
3237
git merge-base --is-ancestor "$GITHUB_SHA" "origin/$DEFAULT_BRANCH" \
3338
|| { echo "release $RELEASE_TAG not reachable from $DEFAULT_BRANCH — refusing"; exit 1; }
3439
3540
stage-publish:
3641
needs: verify
3742
runs-on: ubuntu-latest
43+
timeout-minutes: 15 # bound a hung publish instead of running to the 6h default
3844
permissions:
3945
contents: read
4046
id-token: write # OIDC trusted publishing: only this job mints the token

0 commit comments

Comments
 (0)