Skip to content

chore(release): automate backport processing on PR merge, and have add-backports accept hashtag and url refs#3897

Merged
rickeylev merged 6 commits into
bazel-contrib:mainfrom
rickeylev:automate-pr-backport-workflow
Jul 4, 2026
Merged

chore(release): automate backport processing on PR merge, and have add-backports accept hashtag and url refs#3897
rickeylev merged 6 commits into
bazel-contrib:mainfrom
rickeylev:automate-pr-backport-workflow

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

Currently, backports must be manually added to the release tracking issue.
This change automates the process by allowing maintainers to comment /backport
on a PR to add it to the active release's backport checklist, and automatically
triggering the backport processing when the PR is merged.

To support this, the following changes were made:

  • Added add-backports subcommand to the release tool to append PRs to the tracking issue.
  • Added on-pr-merged subcommand to verify /backport comment, find the tracking issue, and process backports.
  • Created release_add_backports.yaml reusable workflow to run the add-backports subcommand.
  • Updated on_comment.yaml to parse /backport comments on PRs and trigger the addition.
  • Created on_pr_closed.yaml to detect merged PRs and run the on-pr-merged subcommand.
  • Added unit tests for the new subcommands and URL resolution.

rickeylev added 2 commits July 3, 2026 23:54
Allow backports to be added via PR comments and automatically processed on merge.

- Added 'add-backports' subcommand to append PRs to active release tracking issue.
- Added 'find-release-issue' subcommand to locate the tracking issue for a PR.
- Added unit tests for new subcommands.
- Created 'release_add_backports' reusable workflow.
- Updated comment workflow to parse PR comments.
- Created 'on_pr_closed' workflow to automate processing on merge.
…add-backports

- Replace find-release-issue with on-pr-merged subcommand to handle the merge event in one step.
- Update on_pr_closed.yaml workflow to call on-pr-merged.
- Modify add-backports to accept PR numbers, #numbers, and URLs (strictly for the configured repo).
- Add tests for new subcommands and URL resolution.
@rickeylev rickeylev requested a review from aignas as a code owner July 4, 2026 03:00

@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 introduces two new subcommands, add-backports and on-pr-merged, along with their respective unit tests, to automate the release tracking and backporting process. Feedback focuses on improving robustness and correctness: returning a success exit code (0) instead of 1 when a PR lacks a /backport comment to avoid workflow failures, safely handling potential None values in comment bodies and empty GitHub CLI outputs, deduplicating PR references, and correcting the CLI help text to accurately reflect supported PR reference formats.

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/on_pr_merged.py
Comment thread tests/tools/private/release/on_pr_merged_test.py
Comment thread tools/private/release/on_pr_merged.py
Comment thread tools/private/release/gh.py
Comment thread tools/private/release/add_backports.py
Comment thread tools/private/release/add_backports.py
rickeylev added 4 commits July 4, 2026 03:21
* Refine RELEASING.md backport documentation based on feedback.
* Update process-backports GHA command to not abort on invalid PR refs, but add them to checklist with status=error-invalid-pr.
* Support passing metadata (like status) when adding backports to issue body.
Use `get("body") or ""` to guarantee a string fallback even if the body is explicitly None in API payloads, preventing TypeErrors in regex matching.
Update the set of existing PRs during the insertion loop to detect and skip duplicates in the same input list (including those that normalize to the same reference).
Update the parser help text for the 'prs' argument to reflect that commitish references are no longer supported.
@rickeylev rickeylev merged commit 5fe64d8 into bazel-contrib:main Jul 4, 2026
4 of 6 checks passed
@rickeylev rickeylev deleted the automate-pr-backport-workflow branch July 4, 2026 03:44
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