Skip to content
Latchkey

How to Trigger a Workflow on Deployment Status in GitHub Actions

The deployment_status event fires when a deployment reports a new state, letting you run smoke tests only after a successful deploy.

Add on.deployment_status, then gate on github.event.deployment_status.state == 'success'. Read the target URL from the payload to test the live environment.

Steps

  • Add deployment_status: under on.
  • Gate on github.event.deployment_status.state == 'success'.
  • Read deployment_status.target_url to run smoke tests.

Workflow

.github/workflows/smoke.yml
on:
  deployment_status:
jobs:
  smoke:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      - run: curl --fail "${{ github.event.deployment_status.target_url }}/health"

Gotchas

  • State can be success, failure, error, inactive, or pending; filter for the ones you handle.
  • This event depends on something creating deployments (often a deploy action or the Deployments API).

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →