Skip to content

Instantly share code, notes, and snippets.

@michaelboke
Created April 3, 2017 13:43
Show Gist options
  • Save michaelboke/194e728a3b098d85fa47a7264d0ac02b to your computer and use it in GitHub Desktop.
Save michaelboke/194e728a3b098d85fa47a7264d0ac02b to your computer and use it in GitHub Desktop.
summarize jira tickets between branches, with title lookup
#!/usr/bin/env bash
TARGET="master"
SOURCE="develop"
USERNAME="jirausername"
PASSWORD="jirapassword"
FIELD="summary"
for ISSUE in `git log $TARGET..$SOURCE --pretty=oneline | perl -ne '{ /(\w+)-(\d+)/ && print "$1-$2\n" }' | sort | uniq`; do
JSON=$(curl -s -u $USERNAME:$PASSWORD -X GET https://jira.voiceworks.com/rest/api/latest/issue/$ISSUE?fields=summary)
SUMMARY=$(echo $JSON | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$FIELD'\042/){print $(i+1)}}}' | tr -d '"' | sed -n $1p)
echo "[$ISSUE] $SUMMARY"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment