Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save williamzujkowski/31cb8443a5a00f58568308a9b3c641fc to your computer and use it in GitHub Desktop.

Select an option

Save williamzujkowski/31cb8443a5a00f58568308a9b3c641fc to your computer and use it in GitHub Desktop.
Slack webhook payload with formatted blocks and repository details
# Slack Notification for Security Scan Failures
# Source: https://williamzujkowski.github.io/posts/2025-10-06-automated-security-scanning-pipeline/
# Purpose: Send formatted Slack alerts when security scans fail
# Usage: Add to security-gate job in GitHub Actions workflow
- name: Send Slack notification
if: failure()
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"text": "🚨 Security scan failed for ${{ github.repository }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Security Scan Failed*\n*Repository:* ${{ github.repository }}\n*Branch:* ${{ github.ref_name }}\n*Commit:* ${{ github.sha }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "View details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment