Skip to content
Snippets Groups Projects
Commit c031463f authored by jurgenhaas's avatar jurgenhaas
Browse files

gitlab-ci-cd/drupal#57 Allow the merge script to exit gracefully if no changes are available

parent 881af54b
No related branches found
Tags v2.2.9
1 merge request!54Merging develop into main
......@@ -29,10 +29,13 @@ fi
git fetch
rm /tmp/glab.log >/dev/null 2>&1 || true
glab mr create --fill --yes --source-branch ${SOURCEBRANCH} --target-branch ${TARGETBRANCH} --title "$TITLE" > /tmp/glab.log
glab mr create --fill --yes --source-branch ${SOURCEBRANCH} --target-branch ${TARGETBRANCH} --title "$TITLE" > /tmp/glab.log 2>&1
EC=0
grep "could not find any commits" /tmp/glab.log || EC=$?
if [[ $EC -eq 0 ]]; then echo "No changes available."; exit 0; fi
EC=0
grep "Failed to create merge request." /tmp/glab.log || EC=$?
if [[ $EC -eq 0 ]]; then glab mr create --recover > /tmp/glab.log; fi
if [[ $EC -eq 0 ]]; then glab mr create --recover > /tmp/glab.log 2>&1; fi
EC=0
grep "Failed to create merge request." /tmp/glab.log || EC=$?
if [[ $EC -eq 0 ]]; then exit 1; fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment