Handle issues:labeled trigger for cherry-pick on already-merged PRs - #72
Merged
GoutamD2905 merged 1 commit intoAug 7, 2026
Conversation
- Add pr_number_override input to support triggering from issues:labeled event - Fetch PR context (title, URL, merge SHA) via API when pull_request context is empty - Fix CURRENT_PR_URL in parse_meta for issues event using format() expression
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support to the shared cherry-pick reusable workflow for being triggered from an issues:labeled event on already-merged PRs (where github.event.pull_request context is unavailable), by allowing the caller to pass an explicit PR number and fetching PR metadata via the GitHub API.
Changes:
- Introduces a
pr_number_overrideinput for post-mergeissues:labeledscenarios. - Constructs
CURRENT_PR_URLfrom the override to keep label-propagation “self” detection working. - When override is used, fetches PR title/URL/merge SHA via
gh pr viewand skips if the PR isn’t merged.
Suppressed comments (1)
.github/workflows/cherry-pick.yml:144
- If
merge_commit_shais empty (e.g., labeled event on an open PR or a closed-but-unmerged PR),MERGE_SHAbecomes empty and the subsequent git commands can operate on an invalid ref. Add an explicit guard before attempting to resolve commits.
# Resolve commits that landed on base branch, handling all merge strategies
MERGE_SHA="${MERGE_SHA:-${{ github.event.pull_request.merge_commit_sha }}}"
if git cat-file -e "${MERGE_SHA}^2" 2>/dev/null; then
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GoutamD2905
approved these changes
Aug 7, 2026
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to #70. Adds support for adding a
cherry-pick to <branch>label to a PR that was already merged days/weeks ago.Problem: GitHub does not fire
pull_request: labeledevents on closed/merged PRs, so labels added after merge were silently ignored.Fix:
pr_number_overrideinput to the shared engineissues: labeledon a merged PR, fetches PR title, URL and merge SHA from the APIstate != MERGEDcheck)CURRENT_PR_URLin the propagation step constructed correctly for the issues eventReason for change: Enable cherry-pick labels to be added at any time after merge
Test Procedure: Add label to an already-merged PR — workflow fires and creates backport PR
Risks: Low
Priority: P1