From 389a52792390fb2bbb1acc248db732d549b375ad Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 14 Nov 2023 13:52:25 -0800 Subject: [PATCH] tighten set +e --- .github/workflows/label-cherry-pick.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/label-cherry-pick.yaml b/.github/workflows/label-cherry-pick.yaml index 165d5834af7db..2243a17d14266 100644 --- a/.github/workflows/label-cherry-pick.yaml +++ b/.github/workflows/label-cherry-pick.yaml @@ -76,7 +76,6 @@ jobs: run: | set -x git fetch origin ${{ matrix.target_branch }} - set +e rev_list=`git rev-list --parents -n 1 ${MERGE_COMMIT_SHA}` hash_count=`wc -w <<< ${rev_list}` @@ -84,21 +83,21 @@ jobs: # git rev-list returns a list of hashes: [...] # It's not a merge commit if there are less than three (i.e. less than two parents). if [ ${hash_count} -lt 3 ]; then + set +e git cherry-pick -x ${MERGE_COMMIT_SHA} RES=$? + set -e if [ ${RES} -ne 0 ]; then # If the cherry pick failed due to a merge conflict we can # add the conflicting file and create the commit anyway. git add . git cherry-pick --continue - exit ${RES} fi else # This commit is a merge commit and has multiple parents. # Select the first parent (-m 1) as the mainline tree. git cherry-pick -x -m 1 ${MERGE_COMMIT_SHA} - RES=$? fi - name: Create Pull Request