Skip to content

Check npm registry instead of git diff in release workflow - #1

Merged
jbrixon merged 3 commits into
mainfrom
copilot/update-release-workflow-checks
Nov 9, 2025
Merged

jbrixon merged 3 commits into
mainfrom
copilot/update-release-workflow-checks

Conversation

Copilot AI commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

Release workflow now checks if a version exists on npm registry instead of checking git commit history for version changes. This prevents publish failures when the version in package.json hasn't changed but also hasn't been published yet.

Changes

  • check-version job: Replace git diff HEAD^ HEAD -- package.json check with npm view <package>@<version> registry query
  • Job outputs: Changed from version-changed to should-publish boolean
  • Release condition: Gate on should-publish == 'true' instead of version-changed == 'true'
  • Checkout step: Remove fetch-depth: 2 since git history comparison is no longer needed

Behavior

# Before: checked git commits
if git diff HEAD^ HEAD -- package.json | grep -q '"version"'; then
  publish  # Could fail if version already on npm
fi

# After: checks npm registry
if npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null; then
  skip  # Version already published
else
  publish  # Proceed with release
fi

The workflow now exits gracefully when attempting to publish an existing version rather than failing at the npm publish step.

Original prompt

Change the release workflow. it should not only run when the given version number has been changed. instead, check whether the version number has already been published to npm. if it has exit. If it has not, continue to publish.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 9, 2025 10:28
Co-authored-by: jbrixon <25202551+jbrixon@users.noreply.github.com>
Co-authored-by: jbrixon <25202551+jbrixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Update release workflow to check published version Check npm registry instead of git diff in release workflow Nov 9, 2025
Copilot AI requested a review from jbrixon November 9, 2025 10:32
@jbrixon
jbrixon marked this pull request as ready for review November 9, 2025 10:51
@jbrixon
jbrixon merged commit 817d2f2 into main Nov 9, 2025
@jbrixon
jbrixon deleted the copilot/update-release-workflow-checks branch November 9, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants