Skip to content

fix: Fix release workflow - #4

Closed
Abhi347 wants to merge 1 commit into
mainfrom
fix/fix-release-workflow2
Closed

Abhi347 wants to merge 1 commit into
mainfrom
fix/fix-release-workflow2

Conversation

@Abhi347

@Abhi347 Abhi347 commented Jan 11, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings January 11, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown

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 aims to fix the release workflow by adding GitHub Release creation functionality and making a minor adjustment to file reading in the CI workflow.

Changes:

  • Removed manual pnpm authentication configuration in favor of using the NODE_AUTH_TOKEN environment variable
  • Added a new step to automatically create GitHub Releases with generated notes
  • Modified the file reading approach in the CI workflow's version comparison logic

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/release.yml Removed pnpm config authentication line and added automated GitHub Release creation step
.github/workflows/ci.yml Changed file reading method from using encoding parameter to using toString() method

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

Comment on lines 49 to 53
- name: Publish to GitHub Packages
run: |
pnpm config set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }}
pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

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

The removal of the pnpm config line may cause authentication issues when publishing to GitHub Packages. The NODE_AUTH_TOKEN environment variable alone is not sufficient for pnpm to authenticate with GitHub Packages. You need to either:

  1. Keep the pnpm config set command to configure the auth token, or
  2. Add a .npmrc file to the repository with the registry configuration, or
  3. Configure the registry-url parameter in the actions/setup-node step to automatically set up authentication

Without proper authentication configuration, the pnpm publish command will likely fail when attempting to publish to https://npm.pkg.github.com/.

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +60
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(node -p "require('./package.json').version")
gh release create v$VERSION --generate-notes

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

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

The gh CLI tool is being used but it's not guaranteed to be available in the GitHub Actions runner. While gh is pre-installed on GitHub-hosted runners, the workflow should explicitly verify this or use the official actions/create-release action or gh-actions/create-release for more reliability and clarity. Additionally, consider adding error handling to check if the release already exists before attempting to create it.

Suggested change
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(node -p "require('./package.json').version")
gh release create v$VERSION --generate-notes
- name: Get package version
id: get_version
run: |
echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
- name: Check if GitHub Release exists
id: check_release
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const tag = 'v${{ steps.get_version.outputs.version }}';
try {
await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag,
});
core.setOutput('exists', 'true');
} catch (error) {
if (error.status === 404) {
core.setOutput('exists', 'false');
} else {
throw error;
}
}
- name: Create GitHub Release
if: steps.check_release.outputs.exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: v${{ steps.get_version.outputs.version }}
generate_release_notes: true

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
# Get versions
CURRENT_VERSION=$(node -p "require('./package.json').version")
OLD_VERSION=$(git show main:package.json | node -p "JSON.parse(require('fs').readFileSync(0, 'utf-8')).version")
OLD_VERSION=$(git show main:package.json | node -p "JSON.parse(require('fs').readFileSync(0).toString()).version")

Copilot AI Jan 11, 2026

Copy link

Choose a reason for hiding this comment

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

The change from readFileSync(0, 'utf-8') to readFileSync(0).toString() is functionally equivalent but the original approach with the encoding parameter is more direct and readable. However, this change doesn't appear to provide any functional improvement or fix an actual issue. The original code was already correct as readFileSync accepts an encoding parameter as the second argument when reading from file descriptor 0 (stdin).

Suggested change
OLD_VERSION=$(git show main:package.json | node -p "JSON.parse(require('fs').readFileSync(0).toString()).version")
OLD_VERSION=$(git show main:package.json | node -p "JSON.parse(require('fs').readFileSync(0, 'utf-8')).version")

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Jan 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Abhi347 Abhi347 closed this Feb 18, 2026
@Abhi347
Abhi347 deleted the fix/fix-release-workflow2 branch February 18, 2026 06:53
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