Skip to content

Instantly share code, notes, and snippets.

@ktaragorn
Last active March 21, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktaragorn/983798a497760f2e45bbe8895bce3fe3 to your computer and use it in GitHub Desktop.
Save ktaragorn/983798a497760f2e45bbe8895bce3fe3 to your computer and use it in GitHub Desktop.
Which issues have commits in the specified release branch
#!/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)
@ktaragorn
Copy link
Author

ktaragorn commented Mar 9, 2017

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)

@ktaragorn
Copy link
Author

Displays Issues and Pull Requests seperately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment