-
Notifications
You must be signed in to change notification settings - Fork 4
Add changelog preview workflow for pull requests #81
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
Conversation
d93f6c7 to
5691abb
Compare
📝 Changelog Previewℹ️ This PR will not trigger a new release. To trigger a release, ensure your commits follow the Conventional Commits format with types that trigger releases (e.g., |
1b0878b to
bf3b014
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
126abbc to
ad397d2
Compare
Co-authored-by: pawcoding <[email protected]>
ad397d2 to
06c259e
Compare
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 adds a GitHub Actions workflow to generate and post changelog previews on pull requests using semantic-release in dry-run mode. The workflow automatically comments on PRs with either the expected changelog/version, a message indicating no release will be triggered, or an error message if the preview generation fails.
Key changes:
- New GitHub Actions workflow (
changelog-preview.yaml) that triggers on PR events and uses semantic-release to generate changelog previews - Modified
release.config.cjsto support dry-run mode by conditionally disabling npm publishing based on aDRY_RUNenvironment variable
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
.github/workflows/changelog-preview.yaml |
New workflow that generates changelog previews on PRs using semantic-release dry-run mode and posts results as PR comments |
release.config.cjs |
Added DRY_RUN environment variable handling to conditionally disable npm publishing during dry-run executions |
I've identified several critical and moderate issues with the implementation that need to be addressed:
- Missing git history setup: The workflow needs
fetch-depth: 0to fetch full git history for semantic-release to properly analyze commits - Missing Node.js setup and dependencies: The workflow lacks steps to setup Node.js, enable corepack, and install dependencies (which are required for semantic-release plugins)
- Branch configuration issue: The branches array configuration may not correctly identify commits to include in the changelog
- Missing version in preview: The changelog preview message doesn't display the version number that will be released
- String boolean handling: The
dryRunenvironment variable check in release.config.cjs doesn't properly handle string-to-boolean conversion - Inaccurate documentation: Comments in the workflow describe behavior that doesn't match the actual implementation
These issues should be resolved to ensure the workflow functions correctly and provides accurate changelog previews.
| 'master', | ||
| '${{ github.head_ref }}' |
Copilot
AI
Dec 16, 2025
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 branches configuration uses github.head_ref which only contains the branch name (e.g., 'feature-branch'), but semantic-release needs to analyze commits reachable from this ref. Since the workflow checks out the PR head and semantic-release analyzes from the base branch, this configuration may not correctly identify which commits to include in the changelog. Consider using a wildcard pattern like {name: '*', prerelease: true} to allow semantic-release to work with any branch, or ensure the base branch is properly configured for comparison.
| 'master', | |
| '${{ github.head_ref }}' | |
| "master", | |
| { "name": "*", "prerelease": true } |
Changes
Summary:
Adds a GitHub Action workflow that generates and posts changelog previews on PRs using semantic-release dry-run. The workflow uses a wildcard branch pattern to support GitHub's PR merge refs and includes all necessary setup steps.
Issues
Related issues:
Dependencies
Depends on:
N/A
Testing
How to test:
feat:,fix:)Test coverage:
Code Quality
Code review checklist:
Breaking Changes
Are there any breaking changes?
Migration notes:
N/A
Additional Context
Workflow behavior:
The workflow (
changelog-preview.yaml):semantic-releasewithdry_run: trueusing a wildcard branch pattern to support any branch including GitHub's PR merge refs (refs/pull/*/merge)marocchino/sticky-pull-request-comment@v2for idempotent comment updatesKey implementation details:
{name: '*', prerelease: true}allows semantic-release to run on any branchfetch-depth: 0) for proper semantic analysisnpm cito ensure release configuration is availableExample output:
When PR contains
feat:orfix:commits:When no release will be triggered:
When workflow fails:
## 📝 Changelog Preview ⚠️ Failed to generate changelog preview. Please check the workflow logs for details.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.