-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hi @chelnak, the gh changelog new command seems to get confused if there multiple active branches and tags.
For example, https://github.com/puppetlabs/facter only has one active branch (main), so this works:
❯ gh changelog new --from-version 4.6.0 --next-version 4.7.1
❯ cat CHANGELOG.md
...
## [4.7.0](https://github.com/puppetlabs/facter/tree/4.7.0) - 2024-04-09
[Full Changelog](https://github.com/puppetlabs/facter/compare/4.6.1...4.7.0)
...
But puppet has two active branches. If I'm on main, then this doesn't work:
❯ gh changelog new --from-version 7.29.1 --next-version 7.30.1
⠦ Fetching tags...
❌ It looks like something went wrong!
Reported errors:
• the next version should be greater than the former: '7.30.1' ≤ '8.6.0'
And neither does checking out the 7.x branch:
❯ git checkout 7.x
Branch '7.x' set up to track remote branch '7.x' from 'origin'.
Switched to a new branch '7.x'
❯ gh changelog new --from-version 7.29.1 --next-version 7.30.1
⠴ Fetching tags...
❌ It looks like something went wrong!
Reported errors:
• the next version should be greater than the former: '7.30.1' ≤ '8.6.0'
If I remove --next-version, then it generates the changelog, but interleaves the tags from different branches:
❯ gh changelog new --from-version 7.29.1
✓ Open CHANGELOG.md or run 'gh changelog show' to view your changelog.
❯ cat CHANGELOG.md
...
[Full Changelog](https://github.com/puppetlabs/puppet/compare/8.5.1...7.30.0)
Note the last line going from 8.5.1...7.30.0. For example, git knows 8.5.1 is not an ancestor of 7.x, but is of main:
❯ git merge-base --is-ancestor 8.5.1 7.x
❯ echo $?
1
❯ git merge-base --is-ancestor 7.30.0 7.x
❯ echo $?
0
I was hoping gh changelog new would only report on pull requests whose merge commits are contained within the specified --from-version to --next-version range.
I don't believe this is a dup of #144 (but maybe related)?