matrix-notifier: use link formatting when enabled

Make the link formatted to provide a shorter, more good-looking message.
This commit is contained in:
Bruno BELANYI 2021-06-16 20:42:56 +02:00
parent fe0de738b0
commit d2b019f29d

View file

@ -40,7 +40,12 @@ rawurlencode() {
default_drone_message() { default_drone_message() {
local msg="Build ${DRONE_BUILD_STATUS}" local msg="Build ${DRONE_BUILD_STATUS}"
msg="$msg ${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}" local drone_url="${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}"
if [ "$FORMAT" == "true" ]; then
msg="$msg [${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}#${DRONE_COMMIT:0:8}]($drone_url)"
else
msg="$msg $drone_url"
fi
msg="$msg (${DRONE_TAG:-$DRONE_BRANCH})" msg="$msg (${DRONE_TAG:-$DRONE_BRANCH})"
printf '%s' "$msg" printf '%s' "$msg"
} }