Add changelog generation tool for GitHub milestones - #13063
Conversation
|
hmm, the uv.lock file is making the RAT check mad. Should I remove uv.lock? |
I think it's recommended to add uv.lock to ensure the exact packages are added. Let's add it back. The problem wasn't your patch adding the lock, the problem is the RAT check incorrectly failing on the lock file. I'll update CI to allow it. Update |
2b949cf to
44f4931
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Python-based changelog generator under tools/changelog/ to produce CHANGELOG-*-style output from GitHub milestones (via direct REST API calls or the gh CLI), and updates the release-process documentation to use it.
Changes:
- Add
tools/changelog/changelog.pywith text/YAML output and an extended--docmode for richer metadata. - Add
tools/changelog/pyproject.tomlandtools/changelog/uv.lockfor dependency management/execution viauv. - Update release-process docs to use the new tool (with
--use-gh).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| tools/changelog/changelog.py | Implements milestone PR collection via REST API or gh, plus output formatting. |
| tools/changelog/pyproject.toml | Defines the Python project and console script entry point. |
| tools/changelog/uv.lock | Pins Python dependencies for uv-managed execution. |
| doc/developer-guide/release-process/index.en.rst | Updates the documented release workflow to generate changelogs via the new tool. |
e208668 to
cd07fa5
Compare
There was a problem hiding this comment.
Pull request overview
Replaces the legacy Perl-based milestone changelog generator with a new Python tool under tools/changelog/ that can pull merged PRs for a milestone via the GitHub REST API or the gh CLI, and updates the release process docs accordingly.
Changes:
- Removed
tools/git/changelog.pl(Perl implementation). - Added a Python-based changelog generator (
tools/changelog/changelog.py) with apyproject.toml+uv.lockfor dependency management. - Updated release-process documentation to use the new tool.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/git/changelog.pl | Removes the old Perl changelog generator. |
| tools/changelog/changelog.py | New Python tool for generating milestone changelogs via GitHub API or gh, with optional doc/YAML output. |
| tools/changelog/pyproject.toml | Defines the Python tool project and dependencies. |
| tools/changelog/uv.lock | Locks Python dependencies for reproducible runs via uv. |
| doc/developer-guide/release-process/index.en.rst | Updates release instructions to use the new Python tool. |
|
[approve ci autest 2] |
bryancall
left a comment
There was a problem hiding this comment.
Nice to see this move off Perl. The default httpx path looks solid: explicit rate-limit checks, raise_for_status, distinct exit codes, and a good unauthenticated-token warning.
One thing I want fixed before merge. In the --use-gh path, the per-PR merge check treats any non-zero gh api .../merge exit as "not merged" and skips the PR (changelog.py L130). That collapses a genuine 404 (really not merged) together with 403 secondary rate limiting, 5xx, and network errors into the same outcome. Since this makes one API call per PR across a whole milestone, secondary rate limiting is exactly the failure to expect, and when it hits you get a silently incomplete release changelog with a zero exit code. The httpx path already does this right in _is_merged (204 vs 404 vs raise_for_status). Please have the gh path distinguish 404 from other failures and error out on the rest instead of silently skipping. Same goes for the --doc detail fetch, which substitutes empty sha/body on failure rather than surfacing it.
Smaller items, not blocking:
--dochelp and the module docstring say "full commit message" but the code stores the PR body. Fix the wording (or fetch the actual commit message).- The
-a/--authtoken is visible inpsand shell history. Carried over from the old script, but for new code prefer GH_TOKEN only and mark-aas discouraged. pyproject.tomlis missinglicense = "Apache-2.0"that the other tool packages set, andmain()is missing a-> Nonereturn annotation.
The Copilot notes about milestone state=all and a --format yaml JSON fallback are already handled in the current code: both milestone lookups use state=all, and yaml exits with a clear error when PyYAML is missing.
Replaces tools/git/changelog.pl with a Python implementation that generates changelogs from merged PRs in a milestone using the GitHub API or gh CLI. Default output matches the existing CHANGELOG-* file format. The --doc mode includes merge SHAs, labels, and full PR descriptions to guide AI-assisted release documentation updates. Supports text and YAML output formats. Co-Authored-By: Claude <noreply@anthropic.com>
Replace reference to tools/git/changelog.pl with the new tools/changelog/changelog.py invocation using uv run. Co-Authored-By: Claude <noreply@anthropic.com> fix python formatting
copilot review
Any non-zero `gh api .../merge` exit was read as "not merged", so 403 secondary rate limiting or a 5xx silently dropped merged PRs from a release changelog while still exiting 0. That is the failure to expect, since the check runs once per PR across a whole milestone. Use --include so the status line separates a real 404 from a transport or rate-limit error, and exit on anything else. The --doc detail fetch fails the same way now rather than substituting an empty sha and body. Also correct the --doc wording, which stores the PR body and not the commit message; discourage -a, since it exposes the token in ps output and shell history; and declare the Apache-2.0 license that the sibling tool packages set.
060a524 to
298c1fd
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The committed uv.lock is tied to an internal package registry and the new tool has a couple of correctness/UX issues called out in review comments that should be resolved before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 4/5 changed files
- Comments generated: 2
- Review effort level: Lite
| matches = re.findall(r"#(\d+)", subject) | ||
| number = int(matches[-1]) if matches else None |
| def _check_rate_limit(resp: httpx.Response) -> None: | ||
| if resp.status_code == 403: | ||
| print( | ||
| "You have exceeded your rate limit. Try using an auth token.", | ||
| file=sys.stderr, | ||
| ) | ||
| sys.exit(2) |
Replaces tools/git/changelog.pl with a Python implementation that generates changelogs from merged PRs in a milestone using the GitHub API or gh CLI. Default output matches the existing CHANGELOG-* file format. The --doc mode includes merge SHAs, labels, and full PR descriptions to guide AI-assisted release documentation updates. Supports text and YAML output formats.