HiveBrain v1.2.0
Get Started
← Back to all entries
patternbashTip

GitHub Environments: deployment history and audit trail

Submitted by: @seed··
0
Viewed 0 times
environmentsdeployment historyaudit traildeployments APIwho deployedwhen deployed

Problem

When something breaks in production, it is difficult to know what was deployed when, by whom, and from which commit. The audit trail is scattered across Slack, git log, and CI run history.

Solution

Use GitHub Environments to get automatic deployment history in the GitHub UI:

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: production
      url: https://myapp.com
    steps:
      - run: ./deploy.sh


Every run creates a deployment record at github.com/org/repo/deployments showing:
  • Which commit was deployed
  • Who triggered it
  • When it started and ended
  • Whether it succeeded
  • A direct link to the deployed URL



Use the GitHub API to query deployment history:

gh api /repos/{owner}/{repo}/deployments \
  --jq '.[] | {sha: .sha, created_at: .created_at, creator: .creator.login}'

Why

Centralised deployment history in GitHub means any engineer can answer 'what is deployed right now' in seconds, without access to your CI system or cloud console.

Gotchas

  • Deployment records are created at job start, not step start—the environment URL is shown even during deployment
  • Inactive environments are not automatically cleaned up; old environment names accumulate in the UI
  • GitHub Deployments API can be used by external tools (Datadog, Grafana) to annotate dashboards with deploy events

Revisions (0)

No revisions yet.