Skip to content

Add Slack notifications for analytics deployment workflows (dbt + Terraform)#79

Open
SonaliBedge wants to merge 1 commit into
mainfrom
sonali/mfb-877-data-deployment-slack-notifications
Open

Add Slack notifications for analytics deployment workflows (dbt + Terraform)#79
SonaliBedge wants to merge 1 commit into
mainfrom
sonali/mfb-877-data-deployment-slack-notifications

Conversation

@SonaliBedge

@SonaliBedge SonaliBedge commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Context & Motivation

  • Fixes #MFB-877
  • Related PR: None

Analytics deployment workflows (dbt-on-merge and terraform-apply) had no visibility into success or failure after a PR merged. Without notifications, a failed dbt build or Terraform apply would go unnoticed until someone manually checked the Actions tab. This adds Slack notifications to the #mfb-releases channel matching the pattern already in place for benefits-api and benefits-calculator.

Changes Made

  • Created .github/actions/analytics-slack-notify/action.yml — a reusable
    composite action that sends a Slack Block Kit message with environment,
    status (success/failure), a direct link to the workflow run, and commit
    info (SHA, author, message)
  • Updated dbt-on-merge.yml — added Get commit info and Notify Slack (success/failure) steps; fires on staging only since this workflow never
    targets production
  • Updated terraform-apply.yml — added same steps; environment label
    (staging or production) is derived dynamically from
    github.event.inputs.environment to match the job's own environment
    expression

Testing

  • dbt models to run: N/A - no dbt model changes
  • Terraform plan reviewed: N/A - no Terraform resources changes
  • Local Metabase tested via docker-compose: N/A
  • Other manual testing steps:
  • After merging, trigger dbt Build on Merge or Terraform Apply
    manually via workflow_dispatch and confirm a Slack message appears
    in #mfb-releases with correct status, environment label, commit
    info, and working "View Logs" link
  • To verify the failure path: temporarily break a step and confirm
    the ❌ message fires

Deployment

  • Production Terraform apply needed: no
  • Metabase container rebuild/redeploy needed: no
  • dbt production run needed (outside nightly cron): no
  • Other post-deployment steps:
    Add SLACK_WEBHOOK_URL as a repository-level secret before
    merging (Settings → Secrets and variables → Actions → Repository
    secrets). It must be repository-level, not environment-scoped,
    because the notify steps run outside the environment context

Notes for Reviewers

The composite action lives at .github/actions/analytics-slack-notify/
following the same local action pattern used in benefits-api

  • Two separate notifications fire when a PR touches both dbt/ and
    dashboards/ — this is intentional (each links to its own workflow run)
    rather than a combined notification via workflow_run, which is
    significantly more complex and unreliable

  • Get commit info uses if: always() so it captures the SHA/author/message
    even when an earlier step failed, ensuring the failure notification
    includes full commit context

  • Known limitations: production notifications currently include commit info
    rather than a release tag/URL — a release-based production deployment
    trigger can be added in a follow-up if needed

  • Future considerations: could add a #mfb-data-alerts channel for nightly
    dbt cron failures separately from merge-triggered deployment notifications

@andreaHG andreaHG left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work here! I'm assuming we'll probably want to remove staging references here since that's not active.

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.

2 participants