Created
January 6, 2017 16:38
-
-
Save kdisneur/c8dbb2f7575380d69fa8193e170a6174 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/sh | |
# put the following line in `~/.config/build_changelog/config`: | |
# OAUTH_TOKEN=<github-personal-token> | |
source ~/.config/build_changelog/config | |
start=${1} | |
end=${2:-"develop"} | |
repo=$(git remote show origin \ | |
| grep "Fetch URL" \ | |
| sed -E 's#[ ]*Fetch URL:[^:]+:([a-zA-Z0-9_]+/[a-zA-Z0-9_]+)(.git)?#\1#') | |
prs=$(git log --oneline ${end}...${start} \ | |
| grep "Merge pull request" \ | |
| grep -v "release/v" \ | |
| sed -E 's/[^#]+#([0-9]+).*/\1/'); | |
for pr in ${prs}; do | |
curl -H "Authorization: token ${OAUTH_TOKEN}" https://api.github.com/repos/${repo}/pulls/${pr} 2> /dev/null \ | |
| grep '"title": ' \ | |
| sed -E "s/[ ]*\"title\":[ ]+\"(.*)\",/* \1 ([#${pr}])/" | |
done | |
echo | |
for pr in ${prs}; do | |
echo "[#${pr}]: https://github.com/${repo}/pull/${pr}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment