Fix YAML parsing error in notify steps - use printf for JSON payload
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
+7
-3
@@ -58,8 +58,10 @@ steps:
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- apk add --no-cache curl git
|
||||
- CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | grep '\.yaml$' | tr '\n' ' ' || echo "unknown")
|
||||
- curl -sf -X POST -H 'Content-Type: application/json' -d "{\"title\":\"Swarm Deploy OK\",\"text\":\"${CHANGED}\",\"themeColor\":\"00aa00\"}" "$TEAMS_WEBHOOK" || true
|
||||
- |
|
||||
CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | grep '\.yaml$' | tr '\n' ' ' || echo "unknown")
|
||||
PAYLOAD=$(printf '{"title":"Swarm Deploy OK","text":"%s","themeColor":"00aa00"}' "$CHANGED")
|
||||
curl -sf -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" "$TEAMS_WEBHOOK" || true
|
||||
secrets: [ teams_webhook ]
|
||||
when:
|
||||
- status: success
|
||||
@@ -68,7 +70,9 @@ steps:
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- apk add --no-cache curl
|
||||
- curl -sf -X POST -H 'Content-Type: application/json' -d "{\"title\":\"Swarm Deploy FAILED\",\"text\":\"${CI_COMMIT_MESSAGE}\",\"themeColor\":\"ff0000\"}" "$TEAMS_WEBHOOK" || true
|
||||
- |
|
||||
PAYLOAD=$(printf '{"title":"Swarm Deploy FAILED","text":"%s","themeColor":"ff0000"}' "$CI_COMMIT_MESSAGE")
|
||||
curl -sf -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" "$TEAMS_WEBHOOK" || true
|
||||
secrets: [ teams_webhook ]
|
||||
when:
|
||||
- status: failure
|
||||
|
||||
Reference in New Issue
Block a user