Last active
September 13, 2016 06:55
-
-
Save yoshida-mediba/87c71a2c38ee56172de8e8bd54364dfd to your computer and use it in GitHub Desktop.
BacklogからIssueをとってきてTalknoteに投げるスクリプト
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 | |
apiurl="https://example.backlog.jp/api/v2/" | |
project="1" | |
apikey="apikey" | |
jqbody=".[].summary, .[].assignee.name, .[].dueDate" | |
function sendMailTalknote() { | |
head="Content-Type: text/plain; charset=ISO-2022-JP"; | |
from="From: notifier@example.com" | |
addr="To: g-00000-000000@mail.talknote.com" | |
body="$1" | |
body=$(echo "${body}" | nkf -Wj) | |
echo -e "${from}\n${addr}\n${head}\n\n${body}" | /usr/sbin/sendmail -t -i | |
} | |
function getBacklogIssue() { | |
curl -sS "${apiurl}issues?projectId\[\]=${project}&count=1&dueDateSince=`date -I -d yesterday`&dueDateUntil=`date -I -d today`&apiKey=${apikey}" | jq -r "${jqbody}" | |
} | |
sendMailTalknote "$(getBacklogIssue)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment