Add notify on failure (webhook)

This commit is contained in:
Miguel Jacq 2025-12-03 17:58:30 +11:00
parent 28c0dd761f
commit 498765c782
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
3 changed files with 41 additions and 0 deletions

View file

@ -25,3 +25,17 @@ jobs:
pyflakes3 tests/*
vulture
bandit -s B110 -r bouquin/
# Notify if any previous step in this job failed
- name: Notify on failure
if: ${{ failure() }}
env:
WEBHOOK_URL: ${{ secrets.NODERED_WEBHOOK_URL }}
REPOSITORY: ${{ forgejo.repository }}
RUN_NUMBER: ${{ forgejo.run_number }}
SERVER_URL: ${{ forgejo.server_url }}
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"repository\":\"$REPOSITORY\",\"run_number\":\"$RUN_NUMBER\",\"status\":\"failure\",\"url\":\"$SERVER_URL/$REPOSITORY/actions/runs/$RUN_NUMBER\"}" \
"$WEBHOOK_URL"