-
-
Save Mayurifag/4d7d4c65a30c0195c4b4696516f079e1 to your computer and use it in GitHub Desktop.
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
# Makes git push and creates Merge Request at the same time | |
# If you follow branch naming convention like "ucp-123/new-authorization", MR title will be "UCP-123 New authorization", which will be cross-linked to Jira | |
# Make sure to replace "ucp" with your shortcut. | |
# IMPORTANT PREREQUISITE: to run `git config committer.name <your_gitlab_username>` once, so that it gets used for `make publish!` to assign MR to you | |
USERNAME := $(shell git config committer.name) | |
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | |
ticket_pattern := ucp-[0-9][0-9][0-9] | |
TICKET := $(shell git rev-parse --abbrev-ref HEAD | grep -o '$(ticket_pattern)' | tr [:lower:] [:upper:]) | |
FEATURE_NAME := $(shell git rev-parse --abbrev-ref HEAD | grep -o '$(ticket_pattern)/.*' | cut -d "/" -f 2 | sed -e 's:-: :g' | awk '{print toupper(substr($$0,0,1))tolower(substr($$0,2))}') | |
publish!: | |
git commit --allow-empty -m "empty commit" | |
git push --force origin $(BRANCH) \ | |
-o merge_request.create \ | |
-o merge_request.target=master \ | |
-o merge_request.assign="$(USERNAME)" \ | |
-o merge_request.label="to-production" \ | |
-o merge_request.title="$(TICKET) $(FEATURE_NAME)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment