Skip to content

chore(release): sync changelog and version markers to main during backports#3903

Merged
rickeylev merged 7 commits into
bazel-contrib:mainfrom
rickeylev:sync-main-changelog-backports
Jul 6, 2026
Merged

chore(release): sync changelog and version markers to main during backports#3903
rickeylev merged 7 commits into
bazel-contrib:mainfrom
rickeylev:sync-main-changelog-backports

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

This PR implements the changes to sync both CHANGELOG.md and version next markers to the main branch when backports are processed.

Key changes:

  • Adds git diff, apply, and apply_check helpers to the release tool.
  • Updates the GitHub helper to support custom PR base and auto-merge.
  • Updates changelog_news.py to support selective news merging and correct semver-sorted insertion, while preserving the static Unreleased section.
  • Updates process_backports.py to collect version marker diffs during cherry-pick, check if they apply cleanly to main, apply them, and report any failures in the PR body.

These changes ensure that the main branch's changelog and version markers remain in sync with the release branch during the backport process.

rickeylev added 4 commits July 5, 2026 18:53
…kports

Collects news files and version marker diffs during backport cherry-picks,
and proposes a PR to main to apply them (with auto-merge).

- Add git diff/apply helpers.
- Update GH helper for PR creation and auto-merge.
- Update changelog utility for selective news and semver sorting.
- Update process_backports to orchestrate the sync PR.
Simplifies the changelog insertion logic to always insert the new release
block at the insertion point, rather than replacing the Unreleased section.
This preserves any user changes to the static Unreleased text in CHANGELOG.md.
Also updates the tests to match the current static Unreleased section format.
Updates _find_insertion_point to raise a ValueError if it cannot find an
existing version in CHANGELOG.md that is smaller than the new version being
inserted. This replaces the previous behavior of appending to the end of the
file, which should not occur in practice.
Also adds a test case to verify this error behavior.
@rickeylev rickeylev requested a review from aignas as a code owner July 5, 2026 19:10

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the release preparation and backport processing tools to sync changelog updates and news file deletions back to the main branch via an automated pull request. It also introduces a more robust changelog insertion mechanism based on version parsing, alongside new Git and GitHub API helper methods. Feedback on these changes includes improving the robustness of version parsing and branch checkouts, ensuring only valid news files are deleted, specifying UTF-8 encoding when writing patch files, and handling edge cases in the changelog insertion logic where no smaller version exists.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tools/private/release/process_backports.py
Comment thread tools/private/release/changelog_news.py
Comment thread tests/tools/private/release/changelog_news_test.py
Comment thread tools/private/release/process_backports.py Outdated
Comment thread tools/private/release/process_backports.py Outdated
Comment thread tools/private/release/changelog_news.py
rickeylev added 3 commits July 6, 2026 01:33
- Use is_news_file helper to avoid accidental deletion of non-news files.
- Make branch checkout robust by resetting existing branch to main.
- Specify UTF-8 encoding when writing patch files.
…ument

- Renames the parameter to .
- Requires it to be passed as a keyword argument.
- Updates all callers and tests.
Add 'Sync Changelog' tasks to checklist when adding backports.
Automatically mark them as done when the sync PR is merged using a new complete-sync-changelog subcommand and GitHub Actions workflow.
@rickeylev rickeylev merged commit bcaf08a into bazel-contrib:main Jul 6, 2026
4 of 6 checks passed
@rickeylev rickeylev deleted the sync-main-changelog-backports branch July 6, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant