From 42a58080ead4a404689d7985e7c6e5928cf2ac77 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Tue, 8 Sep 2026 06:45:23 +0000 Subject: [PATCH] ci(backport): fix issue creation on cherry-pick conflict (#9048) ci(backport): properly create issue on cherry-pick conflict Signed-off-by: Ning Sun --- .github/workflows/backport.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 5832fffe41..3d64c7dd55 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -68,13 +68,16 @@ jobs: git checkout -b "${head_branch}" "origin/${release_branch}" if ! git cherry-pick -x "${MERGE_COMMIT}"; then - echo "ERROR: Cherry-pick failed for ${release_branch}. Creating an issue instead." + echo "ERROR: Cherry-pick failed for ${release_branch}. Aborting and creating an issue instead." + # Abort and clean up first so the repo is back to a sane state, + # even if the issue creation below fails. + git cherry-pick --abort + git checkout -f "${BASE_BRANCH}" + git branch -D "${head_branch}" gh issue create \ --title "Backport failure: PR #${PR_NUMBER} to ${release_branch}" \ --body "Cherry-pick of ${MERGE_COMMIT} (PR #${PR_NUMBER}) failed on ${release_branch}. Manual backport required." \ - git cherry-pick --abort - git checkout "${BASE_BRANCH}" - git branch -D "${head_branch}" + || true continue fi