Skip to content

Instantly share code, notes, and snippets.

@xdbr
Created October 6, 2015 14:10
Show Gist options
  • Save xdbr/8c4eb58c2178f0234352 to your computer and use it in GitHub Desktop.
Save xdbr/8c4eb58c2178f0234352 to your computer and use it in GitHub Desktop.
Redmine holiday-API
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