debian-forge-composer/schutzbot/slack_notification.sh
Ondřej Budai eaf90f5aea schutzbot: shorten the slack notification
We are on a quest to reduce clutter on our Slack channels. Thus,
I decided to simplify the daily CI notifications:
  - the link to the edge pipelines got removed, it's now in bookmarks
  - several words were removed to make the message shorter
  - the link to the pipeline is now a hyperlink
  - the whole message should be a one liner
  - less text is now bold

I've also simplified the format in which we send the message. I think
that the block format used before makes redundant line-breaks.
Unfortunately, the mentions need to be done using user IDs instead
of user names. If you ever need to find them, go to the user's profile,
click on the three dots and select "Copy member ID".
2024-10-24 10:45:24 +02:00

22 lines
628 B
Bash
Executable file

#!/bin/bash
set -eux
if [ -z "${SLACK_WEBHOOK_URL:-}" ]; then
echo "INFO: Variable SLACK_WEBHOOK_URL is undefined"
exit 0
fi
if [ "$3" == "ga" ]; then
MESSAGE="\"<$CI_PIPELINE_URL|GA composes pipeline>: *$1* $2, cc <@U01CUGX9L68>, <@U01Q07AHZ9C>, <@U04PYMDRV5H>\""
else
COMPOSE_ID=$(cat COMPOSE_ID)
COMPOSER_NVR=$(cat COMPOSER_NVR)
MESSAGE="\"<$CI_PIPELINE_URL|Nightly pipeline> ($COMPOSE_ID: $COMPOSER_NVR): *$1* $2, cc <@U01CUGX9L68>, <@U01Q07AHZ9C>, <@U04PYMDRV5H>\""
fi
curl \
-X POST \
-H 'Content-type: application/json' \
--data '{"text": '"$MESSAGE"'}' \
"$SLACK_WEBHOOK_URL"