Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/slack-alerts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Slack Alerts

# Posts to #alerts-github when a monitored workflow fails. Requires the
# SLACK_ALERTS_WEBHOOK_URL secret: a Slack incoming webhook bound to the
# #alerts-github channel (Slack app > Incoming Webhooks).
on:
workflow_run:
workflows: [CI, Release]
types: [completed]

jobs:
notify:
# Alert on failed pushes to main, releases, and manual runs; stay quiet
# for pull request CI, which is visible on the PR itself.
if: >-
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.event != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Post failure to Slack
uses: slackapi/slack-github-action@v2
with:
webhook: ${{ secrets.SLACK_ALERTS_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
text: ":rotating_light: *${{ github.event.workflow_run.name }}* failed in `${{ github.repository }}` on `${{ github.event.workflow_run.head_branch }}` (triggered by ${{ github.event.workflow_run.actor.login }})\n<${{ github.event.workflow_run.html_url }}|View failed run>"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +15 to +26
Loading