Created
January 16, 2018 16:23
-
-
Save pskl/7f739fa40260e9ba9b5ca59d28cd59df 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
# Script to automate Pull Request creation and description | |
# Pick up your commits tagged with an ENG-XXX Jira Id | |
# Outputs link to opened PR so you can fine-tune stuff | |
# /!\ assumes you branched off dev for your topic branch | |
# /!\ assumes you have Hub installed locally (`brew install hub` if not) -> Hub will ask for your credentials to store an Oauth token | |
# /!\ assumes the crucial commits have been tagged in the following fashion: ENG-XXXX <description> | |
JIRA_BROWSE_PATH = 'https://company-subdomain.atlassian.net/browse/' | |
parsing_result = `git cherry -v dev`.split("\n").map do |commit| | |
matches = commit.match(/(ENG-\d+)/) | |
next if matches.nil? | |
jira_id = matches.captures.first | |
description = commit.split(jira_id)[-1] | |
[ description, ":rocket: [#{jira_id}](#{JIRA_BROWSE_PATH}#{jira_id}) #{description}"] | |
end.compact | |
exec( | |
"hub pull-request -m ' \ | |
#{parsing_result.map(&:first).join(",") + "\n" + parsing_result.map(&:last).join("\n")}'" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment