Skip to content

Add npm-publish workflow for Node.js package#85

Merged
TonyCasey merged 1 commit into
mainfrom
TonyCasey-patch-1
Feb 16, 2026
Merged

Add npm-publish workflow for Node.js package#85
TonyCasey merged 1 commit into
mainfrom
TonyCasey-patch-1

Conversation

@TonyCasey
Copy link
Copy Markdown
Owner

@TonyCasey TonyCasey commented Feb 16, 2026

This workflow runs tests and publishes a Node.js package to GitHub Packages upon release creation.

Summary by CodeRabbit

  • Chores
    • Automated build, testing, and package publishing workflows on release creation to streamline the release process and ensure code quality.

This workflow runs tests and publishes a Node.js package to GitHub Packages upon release creation.
Copilot AI review requested due to automatic review settings February 16, 2026 11:10
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@TonyCasey TonyCasey merged commit d3e56b4 into main Feb 16, 2026
4 of 5 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 16, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow was added to automate Node.js package building, testing, and npm publishing on release creation. The workflow runs a build job that executes npm ci and npm test, followed by a publish-npm job that publishes the package to npm using a stored token.

Changes

Cohort / File(s) Summary
GitHub Actions npm Publish Workflow
.github/workflows/npm-publish.yml
New workflow file that defines a two-job pipeline: a build job running npm ci and npm test on Node.js 20, and a publish-npm job that depends on build and publishes to npm registry using NODE_AUTH_TOKEN secret.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch TonyCasey-patch-1

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new GitHub Actions workflow (npm-publish.yml) that is triggered on release creation and is intended to run tests and publish the package. However, the workflow has several critical issues including a mismatch between the PR description (which mentions GitHub Packages) and the actual registry configuration (npmjs.org), a missing build step that would cause publishing to fail, and redundancy with the existing semantic-release automation already in place.

Changes:

  • Added npm-publish.yml workflow with build and publish-npm jobs triggered on release creation
  • Workflow runs tests in build job, then publishes to npm registry in publish-npm job

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +28
- uses: actions/setup-node@v4
with:
node-version: 20
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The CI workflow includes "cache: 'npm'" in the setup-node action (.github/workflows/ci.yml:21) to speed up dependency installation. This workflow should include the same caching configuration for consistency and improved performance.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +23
publish-npm:
needs: build
runs-on: ubuntu-latest
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The release-on-merge workflow includes specific permissions configuration for npm publishing (.github/workflows/release-on-merge.yml:16-20), including "id-token: write" for npm provenance. This workflow should include similar permissions, particularly "id-token: write" if publishing with provenance is desired, or at minimum document why different permissions are appropriate.

Copilot uses AI. Check for mistakes.
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The PR description states this workflow publishes to "GitHub Packages", but the registry URL points to npmjs.org (the public npm registry). If the intent is to publish to GitHub Packages, the registry URL should be "https://npm.pkg.github.com/" instead. If publishing to the public npm registry is intended, the PR description should be updated to reflect this.

Copilot uses AI. Check for mistakes.
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

This workflow specifies Node.js version 20, but the existing CI workflow (.github/workflows/ci.yml:20) and release-on-merge workflow (.github/workflows/release-on-merge.yml:31) both use Node.js version 22. For consistency and to ensure the build environment matches other workflows, this should be updated to version 22.

Copilot uses AI. Check for mistakes.
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

This workflow specifies Node.js version 20, but the existing CI workflow (.github/workflows/ci.yml:20) and release-on-merge workflow (.github/workflows/release-on-merge.yml:31) both use Node.js version 22. For consistency and to ensure the build environment matches other workflows, this should be updated to version 22.

Copilot uses AI. Check for mistakes.
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The publish job is missing a build step before running npm publish. The package.json specifies "files": ["dist"], meaning only the dist directory is published. Without running "npm run build" first (as done in .github/workflows/ci.yml:26-27 and .github/workflows/release-on-merge.yml:37-38), the dist directory will not exist or will be out of date, causing the publish to fail or publish stale code.

Suggested change
- run: npm ci
- run: npm ci
- run: npm run build

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +33
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The existing release-on-merge.yml workflow already handles automated npm publishing via semantic-release on every push to main (.github/workflows/release-on-merge.yml:43-48). This creates a duplicate publishing mechanism that could cause conflicts. Consider whether this workflow is necessary, or if it serves a different purpose than the existing automated release process. If both are needed, clarify the distinct use cases in comments.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +17
- uses: actions/setup-node@v4
with:
node-version: 20
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The CI workflow includes "cache: 'npm'" in the setup-node action (.github/workflows/ci.yml:21) to speed up dependency installation. This workflow should include the same caching configuration for consistency and improved performance.

Copilot uses AI. Check for mistakes.
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