This GitHub Action sends a Slack notification summarizing failed jobs in a workflow run when used with an if: failure() condition.
The action posts a concise message to a Slack channel containing:
- A link to the failed GitHub Actions run
- A list of failed jobs provided by the workflow
- A custom project-branded username and icon
It is intended to be used as the last step (or in a dedicated job) guarded by if: failure() so that it only triggers on failures.
This action depends on:
- SonarSource/vault-action-wrapper to retrieve the Slack token from Vault
- rtCamp/action-slack-notify to send the Slack message
| Input | Description | Required | Default |
|---|---|---|---|
project-name |
The display name of the project; used in the Slack username. | Yes | - |
icon |
Emoji icon for the Slack message (Slack emoji code). | No | :alert: |
slack-channel |
Slack channel (without #) to post the notification into. |
Yes | - |
jobs |
Comma-separated list of job names to report as failed (provided by you). | Yes | - |
Note: The list of failed jobs must be provided via the jobs input by your workflow logic.
No outputs are produced by this action.
jobs:
notify_on_failure:
needs: [ build, test, deploy ] # Example job dependencies
runs-on: ubuntu-latest
if: failure()
permissions:
statuses: read
id-token: write
steps:
- uses: SonarSource/release-github-actions/notify-slack@v1
with:
project-name: 'My Project'
slack-channel: 'engineering-alerts'
jobs: ${{ toJSON(needs) }}- uses: SonarSource/release-github-actions/notify-slack@v1
if: failure()
with:
project-name: 'My Project'
slack-channel: 'engineering-alerts'
jobs: 'build, test'- uses: SonarSource/release-github-actions/notify-slack@v1
if: failure()
with:
project-name: 'My Project'
slack-channel: 'engineering-alerts'
icon: ':rocket:'
jobs: 'build, test'The action is a composite action that:
- Fetches
SLACK_TOKENfrom Vault pathdevelopment/kv/data/slackusingvault-action-wrapper - Uses a workflow-provided
jobsinput (comma-separated string) to populate the "Failed Jobs" section - Constructs a Slack message with run URL and the provided failed jobs list
- Uses
rtCamp/action-slack-notifyto send a minimal styled message (no title/footer) with danger color - Sets Slack username to:
<project-name> CI Notifier - If the
jobslist is empty or not provided, the "Failed Jobs" line will be blank
- Vault policy granting access to
development/kv/data/slackmust be configured for the repository. - The secret at that path must contain a key named
token. - The Slack channel provided must exist and the token must have permission to post there.
- Use
if: failure()on the step or job; otherwise it will also fire on success. project-name,slack-channel, andjobsare required inputs (no defaults).- Do not prefix the channel with
#. - Message formatting is intentionally minimal for quick triage in alert-focused channels.
- How you compute the failed jobs list is up to your workflow; you can use prior steps to gather job results and pass them to this action via
jobs.