Skip to content

Instantly share code, notes, and snippets.

@paulwellnerbou
Last active August 29, 2015 14:23
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 paulwellnerbou/647e84ffa308e392a9a5 to your computer and use it in GitHub Desktop.
Save paulwellnerbou/647e84ffa308e392a9a5 to your computer and use it in GitHub Desktop.
Changelog with GIT and JIRA: Creating JIRA filter URL based on git commits between two revisions with bash
#!/bin/bash
PROJECTKEYS="PROJ1|PROJ2"
JIRABASEURL="http://jira.example.com/"
# Put here your tag names, branches or just revision hashes
FROMREV="release-1.0"
TOREV="origin/master"
# Unfortunately I didn't manage to get the variable $PORJECTKEYS replaced within gawk's gensub()
git log --pretty=oneline $FROMREV..$TOREV \
| egrep "($PROJECTKEYS)-[[:digit:]]" \
| gawk -v projects=$PROJECTKEYS '{print gensub(/.*(PROJ1|PROJ2)-([0-9]{1,5}).*/, "\\1-\\2", "g")}' | sort | uniq | tr '\n' ',' \
| awk -v baseurl="$JIRABASEURL" '{print baseurl "/issues/?jql=key%20in%20(" $0 ")"}' | sed 's/,)/)/' \
| xargs xdg-open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment