echo"$2 request to $3 did not succeed! Responds with code $code instead of $1"
...
...
@@ -62,6 +62,8 @@ if [[ "$host1" != "$host2" ]]; then
echo"This repository doesn't match the provided GitLab instance"
exit 4
fi
echo"Find project ID from remote URL ..."
# shellcheck disable=SC2001
path="$(echo"$path" | sed-e's,\..*,,g')"
gitlab 200 GET projects?search="$path"
...
...
@@ -71,8 +73,9 @@ if [[ $(isNumeric "$PRJID") -eq 1 ]]; then
exit 5
fi
echo"Create merge request ..."
# Create MR
gitlab 200 POST projects/"$PRJID"/merge_requests --data"source_branch=$SOURCEBRANCH"--data"target_branch=$TARGETBRANCH"--data"title=Merging $SOURCEBRANCH into $TARGETBRANCH"
gitlab 201 POST projects/"$PRJID"/merge_requests --data"source_branch=$SOURCEBRANCH"--data"target_branch=$TARGETBRANCH"--data"title=Merging $SOURCEBRANCH into $TARGETBRANCH"
MRID=$(echo"$result" | jq -r ."iid")
if[[$(isNumeric "$MRID")-eq 1 ]];then
echo"Can not create merge request"
...
...
@@ -80,6 +83,7 @@ if [[ $(isNumeric "$MRID") -eq 1 ]]; then
fi
echo"Created MR at $(echo"$result" | jq -r ."web_url")"
echo"Merge ..."
# Merge MR
gitlab 200 PUT projects/"$PRJID"/merge_requests/"$MRID"/merge --data"should_remove_source_branch=0"