-
-
Save jepsenwan/5f11a288e3d1f228fb6eaf64f9654190 to your computer and use it in GitHub Desktop.
Revisions
-
ColCh revised this gist
Jul 13, 2016 . 1 changed file with 38 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ # Gitlab merge request script Creates merge request on Gitlab for you # Installation Download it, add executable perms and place into PATH: ```sh # Place it into ~/.bin mkdir ~/.bin curl https://gist.github.com/ColCh/35c495786e25e33976706016eed7f200/raw/gitlab-merge-request > ~/.bin/gitlab-merge-request chmod +x ~/.bin/gitlab-merge-request ``` Then install some gems for gitlab: ```sh sudo gem install git gitlab ``` Then define environment variables for your Project(I use autoenv with zsh): ```sh # Gitlab api endpoint export GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" # Get it in https://gitlab.com/profile/account export GITLAB_API_PRIVATE_TOKEN="PLACE_IT_HERE" # Get it from https://gitlab.com/api/v3/projects/?private_token=YOUR_PROVATE_TOKEN export GITLAB_PROJECT_ID="1397044" ``` # Usage Push your branch on remote first: ```sh git push ``` Then ```sh gitlab-merge-request ``` Yes! It will prompt you for Merge Request title. -
ColCh created this gist
Jul 13, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/bin/bash # sudo gem install git gitlab first if ! which gitlab >/dev/null 2>&1; then echo "gitlab command not found. Install gitlab gem first" echo " sudo gem install git gitlab" exit 1 fi if [[ ! $GITLAB_PROJECT_ID ]]; then echo "Define project id in GITLAB_PROJECT_ID environment variable" exit 1 fi # Get current branch from GIT branch_name=$(git symbolic-ref -q HEAD) branch_name=${branch_name##refs/heads/} branch_name=${branch_name:-HEAD} BRANCH=$branch_name echo "Merge Request will go from branch $BRANCH to branch master!" echo -n "Enter your title for Merge Request: " read merge_request_title echo # See https://github.com/NARKOZ/gitlab # see: http://www.rubydoc.info/gems/gitlab/3.4.0/Gitlab/Client/MergeRequests#create_merge_request-instance_method gitlab create_merge_request $GITLAB_PROJECT_ID "$merge_request_title" "{source_branch: "$BRANCH", target_branch: 'master'}"