Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BacklogからIssueをとってきてTalknoteに投げるスクリプト
#!/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
You can’t perform that action at this time.