-
-
Notifications
You must be signed in to change notification settings - Fork 261
ci: Add action to validate changelog diffs after merging #7525
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
Open
Mrtenz
wants to merge
10
commits into
main
Choose a base branch
from
mrtenz/validate-changelog-diffs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+216
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mrtenz
commented
Dec 18, 2025
Member
Author
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.
This is a plain JS file so we can just call node check-changelog-diff.cjs without installing dependencies etc.
.github/actions/check-merge-queue-changelogs/check-changelog-diff.cjs
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
This fixes an issue in changelogs where changelog entries may be incorrectly moved after merging into the main branch. Given the following (partial) changelog for example:
After a release, this changelog may look like this:
## [Unreleased] + ## [1.0.0] ### Changed - Changelog entry A ([#1234](...)) - Changelog entry B ([#5678](...)) - Changelog entry C ([#1337](...))But if another PR based on the original changelog also adds an entry to the unreleased section like this:
## [Unreleased] ### Changed - Changelog entry A ([#1234](...)) - Changelog entry B ([#5678](...)) - Changelog entry C ([#1337](...)) + - Changelog entry D ([#0000](...))The final changelog will look like this, since Git can merge the entry based on the other entries around it:
Here it appears that the release included "entry D", but in reality that was meant to be under the unreleased section.
To address this issue, I've added a simple workflow that checks for changelog diffs. It uses a minimal algorithm to parse the markdown files, find entries that are included in unreleased originally, and checks if they still are after merging. If not, the workflow will fail and show an error such as this:
Long term we should solve this problem by using changesets instead, in which case the unreleased changes will never be merged or conflict with each other, but until we figure out how to implement those in our release workflows, we can use this workflow.
References
Checklist
Note
Adds a CI action and job that verify PR-added changelog entries remain in the Unreleased section after merge (including merge queue).
./.github/actions/check-merge-queue-changelogs:pull_requestandmerge_group).CHANGELOG.mdfiles.check-changelog-diff.cjsto ensure PR-added lines stay in[Unreleased]after merge../.github/workflows/lint-build-test.yml:validate-changelog-diffsjob (PRs and merge groups) that uses the new action.Written by Cursor Bugbot for commit 04224ca. This will update automatically on new commits. Configure here.