Report a successful GitHub deployment for verification

If a workflow creates a GitHub deployment but the environment never records it as landed, check whether the workflow publishes its final deployment status.

Complete the deployment after the deploy job succeeds#

A GitHub deployment lands, and its checks start, only when GitHub sends a success deployment status for it to a GitHub Environment the repository's link lists. A deployment with no status records nothing. A GitHub Actions job that names an environment gets its statuses from GitHub. A deployment that a script, workflow step or deploy tool creates through the GitHub API gets none until that step reports one. After the deploy finishes, create a status of success for the deployment, or failure when the deploy failed:

permissions:
  deployments: write

steps:
  # ... create the deployment and deploy; DEPLOYMENT_ID holds the deployment's ID
  - name: Report the deployment status
    if: always()
    env:
      GH_TOKEN: ${{ github.token }}
    run: |
      gh api --method POST "repos/${{ github.repository }}/deployments/$DEPLOYMENT_ID/statuses" \
        -f state="${{ job.status == 'success' && 'success' || 'failure' }}"

If a linked repository recorded no deploy in the environment in the last 30 days and created deployments for a GitHub Environment its link lists, none of which reported a status, the Inbox names the repository and the GitHub Environment and offers Report deployment status, which opens this section. Deploys of the environment's other repositories don't remove the step. The environment's Deploy verification row and Deploys tab name the repository and offer the step too, whether or not the environment recorded a deploy. A deployment counts once it is about an hour old, so a deploy that is still starting raises nothing. The step disappears when one of those deployments reports a status or a deploy of the repository is recorded.

Search help

Tab to a result. Enter to open. Escape to close.