Created
March 2, 2017 20:02
-
-
Save Rahul91/282577777017cacab8e58b59ab7f40a9 to your computer and use it in GitHub Desktop.
Post commit hook for updating jira tickets.
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 | |
USERNAME="jirausername" | |
PASSWORD="jirausername" | |
COMMIT_MESSAGE=$(git log -1 HEAD --format=%s) | |
TICKET=$(echo $COMMIT_MESSAGE | cut -d ":" -f 1) | |
TIMESPENT=$(echo $COMMIT_MESSAGE | cut -d ":" -f 2) | |
COMMENT=$(echo $COMMIT_MESSAGE | cut -d ":" -f 3) | |
response=$(curl -s -D- -X POST -H "Authorization: Basic $(echo -n $USERNAME:$PASSWORD | base64))" -H "Content-Type: application/json" -d '{"comment": "'"$COMMENT"'","timeSpent": "'"$TIMESPENT"'"}' https://ip/rest/api/2/issue/$TICKET/worklog) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment