From e889f7dbcd2002ef93ae860750d7918b68a9d48e Mon Sep 17 00:00:00 2001 From: Alvin Huang <17609145+alvin-huang@users.noreply.github.com> Date: Fri, 29 Jan 2021 19:42:14 -0500 Subject: [PATCH] ci: fail cherrypick if git push fails (#9673) --- .circleci/scripts/cherry-picker.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/scripts/cherry-picker.sh b/.circleci/scripts/cherry-picker.sh index 612689dd6a..191bf1664f 100755 --- a/.circleci/scripts/cherry-picker.sh +++ b/.circleci/scripts/cherry-picker.sh @@ -51,8 +51,8 @@ function cherry_pick_with_slack_notification { local pr_url="$3" git checkout "$branch" || exit 1 - # If git cherry-pick fails, we send a failure notification - if ! git cherry-pick --mainline 1 "$commit"; then + # If git cherry-pick fails or it fails to push, we send a failure notification + if ! (git cherry-pick --mainline 1 "$commit" && git push origin "$branch"); then status "🍒❌ Cherry pick of commit ${commit:0:7} from $pr_url onto $branch failed!" # send slack notification @@ -85,8 +85,6 @@ function cherry_pick_with_slack_notification { # Else we send a success notification else status "🍒✅ Cherry picking of PR commit ${commit:0:7} from ${pr_url} succeeded!" - # push changes to the specified branch - git push origin "$branch" curl -X POST -H 'Content-type: application/json' \ --data \ "{ \