Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,32 @@ on:
release:
types:
- published
- edited

- released
jobs:
# When a prerelease is promoted to a full release, update the npm latest tag
promote:
if: github.event.action == 'released'
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install node 20
uses: actions/setup-node@v6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent action versions across jobs in same workflow

Low Severity

The new promote job uses actions/checkout@v6 and actions/setup-node@v6, while the deploy job in the same file and every other workflow in the repo consistently uses @v4. Mixing major versions within the same workflow file is surprising and increases maintenance burden. checkout@v6 also introduced credential-handling changes with known compatibility caveats, and setup-node@v6 enables npm caching by default (unnecessary here since no npm install runs).

Fix in Cursor Fix in Web

with:
node-version: '20'
registry-url: https://registry.npmjs.org
- name: Promote edge to latest
run: |
VERSION=$(echo "$TAG_NAME" | sed 's/^v//')
PACKAGE=$(node -p "require('./package.json').name")
npm dist-tag add "$PACKAGE@$VERSION" latest
echo "::notice title=Promoted $VERSION to latest::The latest tag now points to $VERSION (was edge-only)"
env:
TAG_NAME: ${{ github.event.release.tag_name }}
NODE_AUTH_TOKEN: ${{secrets.NPM_DEPLOY_TOKEN}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition: promote job runs before deploy publishes

Medium Severity

When a fresh non-prerelease is published, both published and released events can fire, creating two independent workflow runs. The promote job (~20s total) will attempt npm dist-tag add long before the deploy job (~2+ minutes) reaches its npm publish step. Since the version doesn't exist on npm yet, the npm dist-tag add command will fail. The PR description states this scenario is "harmless," but dist-tag add can only be idempotent if the version already exists on npm. The result is a failed workflow run on every non-prerelease publish that triggers both events.

Additional Locations (1)

Fix in Cursor Fix in Web


deploy:
if: github.event.action == 'published'
runs-on: ${{ matrix.os }}
env:
TERM: xterm
Expand Down
Loading