Skip to content

Instantly share code, notes, and snippets.

@karlkfi
Created October 18, 2016 01:48
Show Gist options
  • Save karlkfi/04d118dc5732e852b35b28b8080a7754 to your computer and use it in GitHub Desktop.
Save karlkfi/04d118dc5732e852b35b28b8080a7754 to your computer and use it in GitHub Desktop.
Generate markdown change log from merged PR titles
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# org/repo (e.g. karlkfi/probe)
REPO=$1
# range (e.g. 1.8.4..1.8.5)
RANGE=$2
# username:token (https://github.com/blog/1509-personal-api-tokens)
USERNAME_TOKEN=$3
PRS=$(
git log --merges --oneline ${RANGE} | \
sed "s/.*#\([0-9]*\).*/\1/" | \
sort -n
)
for PR in ${PRS}; do
PR_TITLE="$(curl --fail --location --silent --show-error -u ${USERNAME_TOKEN} https://api.github.com/repos/${REPO}/pulls/${PR} | jq '.title')"
echo "[#${PR}](https://github.com/${REPO}/pulls/${PR}) - ${PR_TITLE}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment