Skip to content

Instantly share code, notes, and snippets.

@holysugar
Created April 4, 2013 09:48
Show Gist options
  • Select an option

  • Save holysugar/5309154 to your computer and use it in GitHub Desktop.

Select an option

Save holysugar/5309154 to your computer and use it in GitHub Desktop.
ブランチ間でマージされた PR を抽出する ruby 使うなら最初から使えばよかった
#!/bin/sh
repo=$1
branch_first=$2
branch_second=$3
token=$4
#format='##{id}: #{title}'
format='* "##{id}: #{title}":#{url}' # for redmine
git log ${branch_first}..${branch_second} --oneline --reverse | awk '/Merge pull request/{ print $5 }' | tr -d '#' | sort | while read f; do
curl "https://api.github.com/repos/${repo}/issues/${f}?oauth_token=${token}" 2>/dev/null |
ruby -rjson -e "o=JSON.parse(STDIN.read);url,id,title = o.values_at(*%w(url number title)); puts %($format)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment