-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenterpoint.sh
executable file
·22 lines (21 loc) · 1.12 KB
/
enterpoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
if [ ! -z "${DING_DING_WEBHOOK_URL}" ]
then
if [ ! -z "${PLUGIN_START}" ]
then
DING_TITLE="build start ${DRONE_REPO}"
DING_MESSAGE="[${DRONE_REPO}|${DRONE_BUILD_NUMBER}](${DRONE_BUILD_LINK}) build of [${DRONE_REPO_NAME}:${DRONE_BRANCH}](${DRONE_COMMIT_LINK}) start by ${DRONE_COMMIT_AUTHOR}"
else
if [ "${DRONE_BUILD_STATUS}" = "success" ]
then
DING_TITLE="build ${DRONE_BUILD_STATUS} ${DRONE_REPO}"
DING_MESSAGE="[${DRONE_REPO}|${DRONE_BUILD_NUMBER}](${DRONE_BUILD_LINK}) build of [${DRONE_REPO_NAME}:${DRONE_BRANCH}](${DRONE_COMMIT_LINK}) ${DRONE_BUILD_STATUS} by ${DRONE_COMMIT_AUTHOR}"
else
DING_TITLE="build ${DRONE_BUILD_STATUS} ${DRONE_REPO}"
DING_MESSAGE="[${DRONE_REPO}|${DRONE_BUILD_NUMBER}](${DRONE_BUILD_LINK}) build of [${DRONE_REPO_NAME}:${DRONE_BRANCH}](${DRONE_COMMIT_LINK}) ${DRONE_BUILD_STATUS} by ${DRONE_COMMIT_AUTHOR}"
fi
fi
curl -X POST -H 'Content-Type: application/json' -d "{'msgtype':'markdown','markdown':{'title':'${DING_TITLE}','text':'${DING_MESSAGE}'}}" ${DING_DING_WEBHOOK_URL}
else
echo "There is no DING_DING_WEBHOOK_URL environment variable"
fi