Last active
January 31, 2018 20:41
-
-
Save freemanlutsk/dc372d239eacb0d8ddaf48667bfc4e14 to your computer and use it in GitHub Desktop.
bash worklog_jira.sh logfile.csv YOUR_PASSWORD
This file contains hidden or 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 | |
USER="freemanlutsk" | |
PASSWORD=$2 | |
# Loading data | |
# bash worklog_jira.sh logfile.csv <your password> | |
# Don't use empty lines in logfile.csv. | |
# cat logfile.csv | |
# DO-20|2017-04-02|3|Comment 456 | |
# ... | |
# DO-50|2017-04-03|8.5|Comment 123. | |
while read i; do | |
echo -n "." | |
echo | |
ISSUE_ID=$(echo $i|awk -F "|" '{print $1}') | |
SPENT_ON=$(echo $i|awk -F "|" '{print $2}') | |
HOURS=$(echo $i|awk -F "|" '{print $3}') | |
COMMENTS=$(echo $i|awk -F "|" '{print $4}') | |
TICKETS_LINK="https://jira.appodeal.com/rest/api/2/issue/$ISSUE_ID/worklog" | |
echo $TICKETS_LINK | |
curl -u $USER:$PASSWORD -s -H "Content-Type: application/json" -X POST -d '{"comment": "'"$COMMENTS"'", "started": "'"$SPENT_ON"'T20:00:00.000+0000", "timeSpent": "'"$HOURS"'h"}' $TICKETS_LINK | |
echo | |
echo "$SPENT_ON Done!" | |
done < $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment