xpeditis2.0/.gitea/actions/notify-security-failure/action.yml
David f2b6782e5c
Some checks failed
Dev CI / Security gate (push) Failing after 1m37s
CD Preprod / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (amd64, backend) (push) Has been skipped
Dev CI / Backend — Lint (push) Has been skipped
Dev CI / Frontend — Lint & Type-check (push) Has been skipped
Dev CI / Backend — Unit Tests (push) Has been skipped
Dev CI / Frontend — Unit Tests (push) Has been skipped
Dev CI / Notify Failure (push) Has been skipped
CD Preprod / Security gate (push) Failing after 1m37s
CD Preprod / Backend — Integration Tests (push) Has been skipped
CD Preprod / Build Backend (push) Has been skipped
CD Preprod / Build Frontend (push) Has been skipped
CD Preprod / Build Log Exporter (push) Has been skipped
CD Preprod / Backend — Lint (push) Has been skipped
CD Preprod / Frontend — Lint & Type-check (push) Has been skipped
CD Preprod / Backend — Unit Tests (push) Has been skipped
CD Preprod / Frontend — Unit Tests (push) Has been skipped
CD Preprod / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (amd64, frontend) (push) Has been skipped
CD Preprod / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (amd64, log-exporter) (push) Has been skipped
CD Preprod / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (arm64, backend) (push) Has been skipped
CD Preprod / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (arm64, frontend) (push) Has been skipped
CD Preprod / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (arm64, log-exporter) (push) Has been skipped
CD Preprod / Deploy to Preprod (push) Has been skipped
CD Preprod / Notify Success (push) Has been skipped
CD Preprod / Notify Failure (push) Has been skipped
CD Production / Security gate (push) Failing after 1m35s
CD Production / Backend — Tests unitaires (push) Has been skipped
CD Production / Frontend — Tests unitaires (push) Has been skipped
CD Production / Backend — Lint (push) Has been skipped
CD Production / Frontend — Lint & Type-check (push) Has been skipped
CD Production / Vérifier l'image de preprod (push) Has been skipped
CD Production / Reconstruire le frontend (URLs de production) (push) Has been skipped
CD Production / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (amd64, backend) (push) Has been skipped
CD Production / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (amd64, frontend) (push) Has been skipped
CD Production / Image security (${{ matrix.service }}, ${{ matrix.arch }}) (amd64, log-exporter) (push) Has been skipped
CD Production / Déployer en production (push) Has been skipped
CD Production / Notifier le succès (push) Has been skipped
CD Production / Notifier l'échec (push) Has been skipped
ci: stop pipelines and alert Discord when the Security gate fails
Lint and unit-test jobs now depend on the Security gate, so a failure
stops every workflow (dev, preprod, main, PR checks) before anything else
runs. The security job posts its own Discord alert; the generic failure
notification skips that case to avoid duplicates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 10:51:05 +02:00

45 lines
1.9 KiB
YAML

name: Notify security gate failure
description: Posts a Discord alert when the Security gate fails and stops the pipeline.
inputs:
webhook-url:
description: Discord webhook URL.
required: true
pipeline:
description: Human-readable pipeline name shown in the alert.
required: true
runs:
using: composite
steps:
- name: Discord
shell: bash
env:
WEBHOOK_URL: ${{ inputs.webhook-url }}
PIPELINE: ${{ inputs.pipeline }}
REF_NAME: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
# Payload built with json.dumps: branch or author names cannot break the JSON.
payload=$(python3 - <<'PY'
import json, os
print(json.dumps({
"content": "@here Security gate en échec — pipeline arrêté",
"embeds": [{
"title": f"🔒 Security gate en échec — {os.environ['PIPELINE']}",
"description": "Aucun lint, test, build ni déploiement n'a été lancé. Consultez l'artefact `security-reports`.",
"color": 15158332,
"fields": [
{"name": "Branche", "value": f"`{os.environ['REF_NAME']}`", "inline": True},
{"name": "Auteur", "value": os.environ["ACTOR"], "inline": True},
{"name": "Commit", "value": f"`{os.environ['SHA'][:7]}`", "inline": True},
{"name": "Workflow", "value": f"[Voir le run]({os.environ['RUN_URL']})", "inline": False},
],
"footer": {"text": f"Xpeditis CI/CD • {os.environ['PIPELINE']}"},
}],
}))
PY
)
curl -fsS --max-time 15 -H "Content-Type: application/json" -d "$payload" "$WEBHOOK_URL" \
|| echo "::warning::Notification Discord non envoyée."