Dépôt d'outils pour le service mobilizon.chapril.org. https://mobilizon.chapril.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

#! /bin/bash
SCRIPT="/srv/mobilizon.chapril.org/tools/rapport_activite/rapport_activite.sh"
source "/etc/chagirbot/chagirbot.conf"
source "/etc/mobilizon.chapril.org/mobilizonchaprilorg.conf"
#
post_report()
{
datafile=$(mktemp /tmp/report_stats_$(date +%Y-%m-%d_%H%M)_XXXX.json)
cat <<EOF > "${datafile}"
{
"issue": {
"notes": "$(/srv/mobilizon.chapril.org/tools/rapport_activite/rapport_activite.sh -p | sed -z 's/\n/\\n/g')"
}
}
EOF
curl -s \
-H "Content-Type: application/json" \
-H "X-Redmine-API-Key: ${REDMINE_API_KEY}" \
-X PUT --data-binary "@${datafile}" \
"${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json"
rm "${datafile}"
}
#
last_comment_date()
{
curl -H "X-Redmine-API-Key: ${REDMINE_API_KEY}" -s "${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json?include=journals" \
| jq '.issue.journals | last | .created_on'
}
#
list()
{
curl -H "X-Redmine-API-Key: ${REDMINE_API_KEY}" -s "${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json?include=journals" \
| jq '.issue.journals[] | [.user.name, .notes]'
}
# Main.
post_report