Refactor release preparation workflow and add automated changelog upd…#102
Refactor release preparation workflow and add automated changelog upd…#102YunchuWang merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the release preparation GitHub Actions workflow by extracting the changelog update logic into a dedicated Node.js script and simplifying PR body generation to avoid YAML escaping pitfalls.
Changes:
- Added
scripts/update-changelog.jsto updateCHANGELOG.mdduring release prep. - Updated
.github/workflows/prepare-release.yamlto call the new script instead of inlinenode -elogic. - Updated PR creation step to generate the PR body via a temporary markdown file (
--body-file).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/update-changelog.js | New script that inserts a new release section into CHANGELOG.md and resets the Upcoming section. |
| .github/workflows/prepare-release.yaml | Uses the new changelog update script and writes PR body to /tmp/pr_body.md for gh pr create. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // This script updates CHANGELOG.md with a new release section | ||
| // Usage: node update-changelog.js <version> <date> <changelog-file> | ||
|
|
||
| const fs = require('fs'); | ||
|
|
||
| const [,, version, releaseDate, changelogFile] = process.argv; | ||
|
|
||
| if (!version || !releaseDate || !changelogFile) { | ||
| console.error('Usage: node update-changelog.js <version> <date> <changelog-file>'); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| const changelogContent = fs.readFileSync(changelogFile, 'utf8').trim(); |
There was a problem hiding this comment.
The script’s CLI contract/documentation is misleading: the third arg is named like a changelog file to update, but the script always reads/writes the hard-coded CHANGELOG.md and uses the arg only as the source of release notes. Consider renaming the arg/usage text (e.g., release-notes-file) or adding an explicit target path parameter and using it instead of hard-coding CHANGELOG.md.
| // This script updates CHANGELOG.md with a new release section | |
| // Usage: node update-changelog.js <version> <date> <changelog-file> | |
| const fs = require('fs'); | |
| const [,, version, releaseDate, changelogFile] = process.argv; | |
| if (!version || !releaseDate || !changelogFile) { | |
| console.error('Usage: node update-changelog.js <version> <date> <changelog-file>'); | |
| process.exit(1); | |
| } | |
| const changelogContent = fs.readFileSync(changelogFile, 'utf8').trim(); | |
| // This script updates CHANGELOG.md with a new release section using the provided release notes file | |
| // Usage: node update-changelog.js <version> <date> <release-notes-file> | |
| const fs = require('fs'); | |
| const [,, version, releaseDate, releaseNotesFile] = process.argv; | |
| if (!version || !releaseDate || !releaseNotesFile) { | |
| console.error('Usage: node update-changelog.js <version> <date> <release-notes-file>'); | |
| process.exit(1); | |
| } | |
| const changelogContent = fs.readFileSync(releaseNotesFile, 'utf8').trim(); |
| const newSection = `## v${version} (${releaseDate}) | ||
|
|
||
| ### Changes | ||
|
|
||
| ${changelogContent} |
There was a problem hiding this comment.
New release entries are created with a ### Changes subsection, but the existing CHANGELOG.md uses ### New / ### Fixes subsections for versioned releases. Please align the generated section headings with the established changelog structure (or update the changelog format consistently across existing entries).
…ate script
Summary
What changed?
Why is this change needed?
Issues / work items
Project checklist
CHANGELOG.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
1.
2.
3.
Notes for reviewers