refactor(drone): simplify discord notification step
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Ching L 2025-09-11 17:50:11 +08:00
parent 3e765f1182
commit 2dafff203b

View File

@ -53,17 +53,18 @@ steps:
- name: extract-commit-title
image: alpine
commands:
- export COMMIT_TITLE="$(echo \"${DRONE_COMMIT_MESSAGE}\" | head -n1)"
- echo "COMMIT_TITLE=$COMMIT_TITLE" >> /drone/env
- export COMMIT_TITLE=$(echo "${DRONE_COMMIT_MESSAGE}" | head -n1)
- echo "COMMIT_TITLE=$COMMIT_TITLE"
- name: discord notification success
- name: discord notification
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
color: "#48f442"
color: >
$(if [ "${DRONE_BUILD_STATUS}" = "success" ]; then echo "#48f442"; else echo "#ff4f42"; fi)
message:
- |
${DRONE_REPO}
@ -71,24 +72,7 @@ steps:
Branch: ${DRONE_COMMIT_BRANCH}
Link: ${DRONE_BUILD_LINK}
when:
status: [success]
- name: discord notification failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
color: "#ff4f42"
message:
- |
${DRONE_REPO}
Commit: ${COMMIT_TITLE}
Branch: ${DRONE_COMMIT_BRANCH}
Link: ${DRONE_BUILD_LINK}
when:
status: [failure]
status: [success, failure]