Skip to content
Snippets Groups Projects
Commit 7a8a76a0 authored by Jürgen Haas's avatar Jürgen Haas
Browse files

Add template to create a MR with proposed changes if a build process creates modifications

parent 738b438d
Branches
No related tags found
No related merge requests found
......@@ -19,8 +19,7 @@ SOURCE_BRANCH=${TARGET_BRANCH}-proposed-update-$(date +%Y-%m-%d-%H-%M-%S)
# Extract the host where the server is running, and add the URL to the APIs
[[ $HOST =~ ^https?://[^/]+ ]] && HOST="${BASH_REMATCH[0]}/api/v4/projects/"
# The description of our new MR, we want to remove the branch after the MR has
# been closed
# The description of our new MR, we want to remove the branch after the MR has been closed
BODY="{
\"id\": ${CI_PROJECT_ID},
\"source_branch\": \"${SOURCE_BRANCH}\",
......@@ -35,16 +34,13 @@ git config --global user.email "${GITLAB_USER_EMAIL}"
git config --global user.name "${GITLAB_USER_NAME}"
git remote add mr ${REPO}
git fetch mr
git pull mr
git branch ${SOURCE_BRANCH}
git checkout ${SOURCE_BRANCH}
git commit -am "GitLab CI proposed changes"
git push -u mr ${SOURCE_BRANCH}
git checkout ${TARGET_BRANCH}
git branch -d ${SOURCE_BRANCH}
git remote remove mr
echo curl -X POST "${HOST}${CI_PROJECT_ID}/merge_requests" \
curl -X POST "${HOST}${CI_PROJECT_ID}/merge_requests" \
--header "PRIVATE-TOKEN:${ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--data "${BODY}";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment