Last active
March 21, 2017 09:13
-
-
Save ktaragorn/983798a497760f2e45bbe8895bce3fe3 to your computer and use it in GitHub Desktop.
Which issues have commits in the specified release branch
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
#!/usr/bin/env ruby | |
unless ARGV.first | |
fail("Provide the name of the release branch. For e.g for release/5.0 provide 5.0 as the branch name") | |
end | |
base = ARGV[1] || "master" | |
puts "Ensure that this is run in the repository you want the data from!" | |
`git fetch` | |
pr_regexp = "Merge pull request" | |
issue_no_regexp = /#(\d{1,5})/ | |
issues = `git log --pretty=oneline origin/release/#{ARGV.first} --not origin/#{base}`.split("\n") | |
pr_no, issue_no = issues.select{|i| i.match(issue_no_regexp)}.partition{|i| i.match(pr_regexp)}.map{|arr| arr.map{|i| i.scan(issue_no_regexp)}.flatten.uniq} | |
def issue_urls nos | |
nos.map{|i| "https://github.com/travelmob/travelmob/issues/#{i}"} | |
end | |
puts "Issues [#{issue_no.count}]" | |
puts issue_urls(issue_no) | |
puts "\n\nPull Requests [#{pr_no.count}]" | |
puts issue_urls(pr_no) |
Displays Issues and Pull Requests seperately
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
USAGE:
cd <repo that follows gitflow>
./release_issues.rb 5.1
(for issues in release/5.1 which isnt on master yet)./release_issues.rb 5.1 release/5.0
(for issues in release/5.1 which wasnt on release/5.0 - this is for cases where 5.1 has been merged into master and thus a custom base needs to be set)