From 6eccae3b4b99a38aa6ad97002fb74da9759e71fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=82CHES?= Date: Wed, 18 Mar 2026 09:26:38 -0600 Subject: [PATCH] fix(ci): skip publish when version already exists on npm (#1166) Multiple CI completions on the same commit trigger duplicate Pipeline runs. The second run fails with E403 because the version was already published. Fix by checking npm registry before attempting publish, and enable cancel-in-progress to avoid redundant runs. Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/pipeline.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index bf4b5491f..a2e707882 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -8,7 +8,7 @@ on: concurrency: group: pipeline-${{ github.sha }} - cancel-in-progress: false + cancel-in-progress: true permissions: contents: write @@ -51,7 +51,13 @@ jobs: echo "version=$(node -e 'process.stdout.write(require("./package.json").version)')" >> "$GITHUB_OUTPUT" - name: Publish @dev - run: npm publish --tag dev + run: | + VERSION=$(node -e 'process.stdout.write(require("./package.json").version)') + if npm view "gsd-pi@${VERSION}" version 2>/dev/null; then + echo "Version ${VERSION} already published — skipping" + else + npm publish --tag dev + fi env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}