Skip to content

ci: alert #alerts-github on CI and Release failures#505

Closed
solvemproblr wants to merge 1 commit into
mainfrom
asa/slack-github-alerts-c67d
Closed

ci: alert #alerts-github on CI and Release failures#505
solvemproblr wants to merge 1 commit into
mainfrom
asa/slack-github-alerts-c67d

Conversation

@solvemproblr

Copy link
Copy Markdown
Contributor

Summary

Adds a Slack Alerts workflow (HUD-2232) that posts to the #alerts-github Slack channel when a monitored workflow fails.

  • Triggers via workflow_run on completion of CI and Release.
  • Alerts only on failures from pushes to main, releases, and manual dispatches. Pull request CI failures are intentionally excluded — those are already visible on the PR itself.
  • Posts via slackapi/slack-github-action using a Slack incoming webhook, so alerting is fully independent of the HUD platform.

Required setup (one-time, org-level)

  1. Create a Slack app (e.g. "GitHub Alerts") with Incoming Webhooks enabled and add a webhook bound to #alerts-github.
  2. Store the webhook URL as a GitHub Actions secret named SLACK_ALERTS_WEBHOOK_URL — ideally at the org level so other repos can reuse it.

Extending to staging/prod deploys

The staging/prod deploy workflows live in the platform repo, not here. Copy this same file there and swap the workflows: list to the deploy workflow names (e.g. [Deploy Staging, Deploy Prod]). With an org-level secret, no other changes are needed.

Testing

  • YAML validated and checked with actionlint (clean).
  • Slack payload block verified to parse as valid YAML with representative values substituted.
  • End-to-end delivery not verified: it requires the SLACK_ALERTS_WEBHOOK_URL secret and a real failed run on main.

Linear Issue: HUD-2232

Open in Web Open in Cursor 

Co-authored-by: Asadullo Ganiev <solvemproblr@users.noreply.github.com>
Comment on lines +15 to +26
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>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants