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