Created
October 6, 2015 14:10
-
-
Save xdbr/8c4eb58c2178f0234352 to your computer and use it in GitHub Desktop.
Redmine holiday-API
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
URL=https://redmine.your-company.com APIKEY=YOURPERSONALAPIKEY MESSAGE="Holiday" HOURS=8.0 ISSUE_ID=issue_id_here LC_ALL=C; \ | |
for weekday in 2015-09-{21..30} 2015-10-{01..04}; do | |
case $((date -jf '%F' $weekday || date -d $weekday) 2>/dev/null | awk '{print $1}') in | |
(Mon|Tue|Wed|Thu|Fri) \ | |
printf "Entering $weekday... " && \ | |
echo '<time_entry> | |
<issue_id>${ISSUE_ID}</issue_id> | |
<hours>${HOURS}</hours> | |
<comments>${MESSAGE}</comments> | |
<spent_on>'${weekday}'</spent_on> | |
</time_entry>' | \ | |
http POST ${URL}/time_entries.xml Content-Type:application/xml X-Redmine-API-Key:$APIKEY &>/dev/null && \ | |
echo Success || echo Fail \ | |
;; | |
(Sat|Sun|*) echo "Skipping $weekday... weekend" ;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment