-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Fix release workflow #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 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.
| - 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
There was a problem hiding this comment.
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:
- Keep the
pnpm config setcommand to configure the auth token, or - Add a
.npmrcfile to the repository with the registry configuration, or - Configure the
registry-urlparameter in theactions/setup-nodestep 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/.
| - 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
There was a problem hiding this comment.
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.
| - 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 |
| # 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
There was a problem hiding this comment.
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).
| 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") |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 246 246
Branches 68 68
=========================================
Hits 246 246
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
No description provided.