Last active
August 29, 2015 14:23
-
-
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
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/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