build: neodesílat notifikace na nenakonfigurované kanály
CI / Generate TypeScript types (push) Successful in 14s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 32s
CI / Build client (push) Successful in 44s
CI / Playwright E2E tests (push) Successful in 1m55s
CI / Build and push Docker image (push) Successful in 45s
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (push) Successful in 14s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 32s
CI / Build client (push) Successful in 44s
CI / Playwright E2E tests (push) Successful in 1m55s
CI / Build and push Docker image (push) Successful in 45s
CI / Notify (push) Successful in 2s
This commit is contained in:
1 file changed
+14
-11
+14
-11
@@ -231,8 +231,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Send webhook
|
- name: Send webhook
|
||||||
env:
|
env:
|
||||||
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
|
|
||||||
NTFY_URL: ${{ secrets.NTFY_URL }}
|
NTFY_URL: ${{ secrets.NTFY_URL }}
|
||||||
BUILD_RESULT: ${{ needs.docker-build.result }}
|
BUILD_RESULT: ${{ needs.docker-build.result }}
|
||||||
RUN_NUMBER: ${{ github.run_number }}
|
RUN_NUMBER: ${{ github.run_number }}
|
||||||
@@ -250,12 +249,16 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
FULL_MSG="$(printf '%s\n\nPipeline: %s\nPoslední commit: %sAutor: %s' \
|
FULL_MSG="$(printf '%s\n\nPipeline: %s\nPoslední commit: %sAutor: %s' \
|
||||||
"$MSG" "$RUN_URL" "$COMMIT_MESSAGE" "$COMMIT_AUTHOR")"
|
"$MSG" "$RUN_URL" "$COMMIT_MESSAGE" "$COMMIT_AUTHOR")"
|
||||||
curl -s -X POST \
|
# Nevyplněné URL = daný kanál notifikací se přeskočí
|
||||||
"https://discord.com/api/webhooks/${DISCORD_WEBHOOK_ID}/${DISCORD_WEBHOOK_TOKEN}" \
|
if [ -n "$DISCORD_WEBHOOK_URL" ]; then
|
||||||
-H "Content-Type: application/json" \
|
curl -sS -f -X POST "${DISCORD_WEBHOOK_URL}" \
|
||||||
--data "$(jq -n --arg content "$FULL_MSG" '{content: $content}')"
|
-H "Content-Type: application/json" \
|
||||||
curl -s -X POST "${NTFY_URL}" \
|
--data "$(jq -n --arg content "$FULL_MSG" '{content: $content}')"
|
||||||
-H "Title: Luncher CI #${RUN_NUMBER}" \
|
fi
|
||||||
-H "Tags: ${NTFY_TAGS}" \
|
if [ -n "$NTFY_URL" ]; then
|
||||||
-H "Click: ${RUN_URL}" \
|
curl -sS -f -X POST "${NTFY_URL}" \
|
||||||
-d "${FULL_MSG}"
|
-H "Title: Luncher CI #${RUN_NUMBER}" \
|
||||||
|
-H "Tags: ${NTFY_TAGS}" \
|
||||||
|
-H "Click: ${RUN_URL}" \
|
||||||
|
-d "${FULL_MSG}"
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user