Skip to content

Commit 0dec096

Browse files
committed
use markdown && fix secrets
1 parent 13aa768 commit 0dec096

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ Put following lines in your .drone.yml
99
pipeline:
1010
notify:
1111
image: wuyue/drone-dingding
12+
secrets: [DING_DING_WEBHOOK_URL]
1213
build:
1314
....
1415
notify:
1516
image: wuyue/drone-dingding
17+
secrets: [DING_DING_WEBHOOK_URL]
1618
when:
17-
status: [ success, failure ]
19+
status: [success, failure]
1820

1921
Set dingding Incoming Webhook URL for notifications
2022

enterpoint.sh

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
#!/bin/sh
22

3-
NOTICE_COLOR=''
4-
53
if [ ! -z "${DING_DING_WEBHOOK_URL}" ]
64
then
75
if [ ! -z "${PLUGIN_START}" ]
86
then
9-
DING_MESSAGE="\`<${DRONE_BUILD_LINK}|${DRONE_BUILD_NUMBER}>\` build of <${DRONE_COMMIT_LINK}|${DRONE_REPO_NAME}:${DRONE_BRANCH}> started"
7+
DING_TITLE="build start ${DRONE_REPO}"
8+
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}"
109
else
11-
1210
if [ "${DRONE_BUILD_STATUS}" = "success" ]
1311
then
14-
DING_MESSAGE="\`<${DRONE_BUILD_LINK}|${DRONE_BUILD_NUMBER}>\` build of <${DRONE_COMMIT_LINK}|${DRONE_REPO_NAME}:${DRONE_BRANCH}> completed"
15-
NOTICE_COLOR='good'
12+
DING_TITLE="build ${DRONE_BUILD_STATUS} ${DRONE_REPO}"
13+
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}"
1614
else
17-
DING_MESSAGE="\`<${DRONE_BUILD_LINK}|${DRONE_BUILD_NUMBER}>\` build of <${DRONE_COMMIT_LINK}|${DRONE_REPO_NAME}:${DRONE_BRANCH}> failed"
18-
NOTICE_COLOR='danger'
15+
DING_TITLE="build ${DRONE_BUILD_STATUS} ${DRONE_REPO}"
16+
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}"
1917
fi
20-
2118
fi
22-
curl -X POST -H 'Content-Type: application/json' -d "{'msgtype':'text','text':{'content':'${DING_MESSAGE}'}}" ${DING_DING_WEBHOOK_URL}
19+
curl -X POST -H 'Content-Type: application/json' -d "{'msgtype':'markdown','markdown':{'title':'${DING_TITLE}','text':'${DING_MESSAGE}'}}" ${DING_DING_WEBHOOK_URL}
2320
else
2421
echo "There is no DING_DING_WEBHOOK_URL environment variable"
2522
fi

0 commit comments

Comments
 (0)