benevalibre.chapril.org-tools/rapport_activite/update_redmine_ticket.sh

29 lines
680 B
Bash
Executable File

#! /bin/bash
source "/etc/benevalibre.chapril.org/benevalibrechaprilorg.conf"
source "/etc/chagirbot/agiraprilorg.conf"
REDMINE_API_KEY="$key"
#
post_report()
{
datafile=$(mktemp /tmp/report_stats_$(date +%Y-%m-%d_%H%M)_XXXX.json)
cat <<EOF > "${datafile}"
{
"issue": {
"notes": "$(/srv/benevalibre.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}"
}
# Main.
post_report