Guides / Platforms & Tools

Log Deployment Events from GitHub Actions

3 min read·Platforms & Tools

Why Log Deployments

Deployments are the highest-risk moment in software. When an incident happens, the first question is "was there a recent deploy?" If you log deployments to LogIt, you can answer that question in one glance at your timeline.

Setup: Add the API Key Secret

In your GitHub repository → Settings → Secrets and variables → Actions, add:

  • LOGIT_API_KEY — your LogIt project API key

Log a Successful Deployment

yaml
# .github/workflows/deploy.yml
name: Deploy to Production

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy
        run: ./scripts/deploy.sh

      - name: Log deployment to LogIt
        if: success()
        run: |
          curl -s -X POST https://api.logit.now/api/ingest \
            -H "Content-Type: application/json" \
            -H "Authorization: Bearer ${{ secrets.LOGIT_API_KEY }}" \
            -d '{
              "channel": "deployments",
              "event": "Production deployment succeeded",
              "description": "Commit ${{ github.sha }} deployed by ${{ github.actor }}",
              "icon": "🚀",
              "notify": true,
              "tags": {
                "branch": "${{ github.ref_name }}",
                "actor": "${{ github.actor }}"
              },
              "metadata": {
                "sha": "${{ github.sha }}",
                "runId": "${{ github.run_id }}",
                "workflow": "${{ github.workflow }}"
              }
            }'

      - name: Log deployment failure to LogIt
        if: failure()
        run: |
          curl -s -X POST https://api.logit.now/api/ingest \
            -H "Content-Type: application/json" \
            -H "Authorization: Bearer ${{ secrets.LOGIT_API_KEY }}" \
            -d '{
              "channel": "deployments",
              "event": "Production deployment failed",
              "description": "Commit ${{ github.sha }} failed — run ${{ github.run_id }}",
              "icon": "❌",
              "notify": true,
              "tags": { "branch": "${{ github.ref_name }}", "status": "failed" },
              "metadata": { "sha": "${{ github.sha }}", "runId": "${{ github.run_id }}" }
            }'

Smart Action: Alert on Back-to-Back Failures

FieldValue
NameConsecutive deploy failures
Channeldeployments
Event nameProduction deployment failed
Threshold2
Window1 hour
Cooldown2 hours
ActionPush notification

Tips

  • Log the commit SHA and run ID so you can correlate a LogIt event to the exact GitHub Actions run.
  • Add deploy events to your incident runbook — "check LogIt deployments channel" should be step one.
  • Log staging deployments to a separate deployments-staging channel to keep the production timeline clean.

Try LogIt free

7-day trial. No credit card required.

Start free