2020-01-26 23:15:42 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
2020-02-22 14:45:34 +01:00
|
|
|
# Lecture configuration drop
|
|
|
|
CONFIG_DROP="/etc/drop.chapril.org/dropchaprilorg.conf"
|
|
|
|
source ${CONFIG_DROP}
|
2020-01-26 23:15:42 +01:00
|
|
|
|
2020-02-22 14:45:34 +01:00
|
|
|
# Lecture configuration agirbot
|
|
|
|
CONFIG_AGIRBOT="/etc/chagirbot/agiraprilorg.conf"
|
|
|
|
source ${CONFIG_AGIRBOT}
|
2020-01-26 23:15:42 +01:00
|
|
|
|
|
|
|
main() {
|
|
|
|
post_report
|
|
|
|
}
|
|
|
|
|
|
|
|
post_report() {
|
|
|
|
datafile=$(mktemp /tmp/report_stats_$(date +%Y-%m-%d_%H%M)_XXXX.json)
|
|
|
|
cat <<EOF > "${datafile}"
|
|
|
|
{
|
|
|
|
"issue": {
|
|
|
|
"notes": "$(/srv/drop.chapril.org/tools/rapports_activites/rapport_activites.sh | sed -z 's/\n/\\n/g')"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
curl -s \
|
|
|
|
-H "Content-Type: application/json" \
|
2020-02-22 14:45:34 +01:00
|
|
|
-H "X-Redmine-API-Key: ${key}" \
|
2020-01-26 23:15:42 +01:00
|
|
|
-X PUT --data-binary "@${datafile}" \
|
|
|
|
"${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json"
|
|
|
|
rm "${datafile}"
|
|
|
|
}
|
|
|
|
|
|
|
|
last_comment_date() {
|
2020-02-22 14:45:34 +01:00
|
|
|
curl -H "X-Redmine-API-Key: ${key}" -s "${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json?include=journals" \
|
2020-01-26 23:15:42 +01:00
|
|
|
| jq '.issue.journals | last | .created_on'
|
|
|
|
}
|
|
|
|
|
|
|
|
list() {
|
2020-02-22 14:45:34 +01:00
|
|
|
curl -H "X-Redmine-API-Key: ${key}" -s "${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json?include=journals" \
|
2020-01-26 23:15:42 +01:00
|
|
|
| jq '.issue.journals[] | [.user.name, .notes]'
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|