Created
July 18, 2017 02:36
-
-
Save fuacici/d9a38ee756a5d772d26483afbf80ba84 to your computer and use it in GitHub Desktop.
.gitlab-ci.yml & Shell scripts for auto merge request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stages: | |
| - load_branches | |
| - master_merge | |
| variables: | |
| create_merge: | |
| stage: master_merge | |
| only: | |
| - master | |
| - ci | |
| tags: | |
| - merge_master | |
| when: | |
| always | |
| script: | |
| - echo $(sh ./create_merges.sh) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BRANCH_TO_MERGE=$(git for-each-ref --format='%(refname:short)' refs/remotes/ |grep -o "DEV_.\+BR$") | |
| for BRANCH in $BRANCH_TO_MERGE | |
| do | |
| echo $BRANCH | |
| echo $(curl -d source_branch=$CI_BUILD_REF_NAME -d target_branch=$BRANCH -d title=Auto_Merge-Master-to-$BRANCH -d description=default "http://git.xxx.com/api/v3/projects/$CI_PROJECT_ID/merge_requests/?private_token=$GITLAB_API_TOKEN") | |
| done | |
| # Please get project id from triggers. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment