Automatically track deployments from GitHub Actions workflows using the official opstrails/track-event action.
OPSTRAILS_API_KEY with a READ_WRITE API keyAdd the following step to your deployment workflow:
- uses: opstrails/track-event@v1
with:
api-key: ${{ secrets.OPSTRAILS_API_KEY }}
type: deployment
subject: production
version: ${{ github.sha }}
description: "Deployed to production"| Input | Required | Description |
|---|---|---|
api-key | required | OpsTrails API key (READ_WRITE scope) |
type | required | Event type (e.g. deployment, rollback) |
subject | optional | Target environment (e.g. production) |
version | optional | Release version or commit SHA |
description | optional | Human-readable description |
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to production
run: ./deploy.sh
- name: Track deployment
uses: opstrails/track-event@v1
with:
api-key: ${{ secrets.OPSTRAILS_API_KEY }}
type: deployment
subject: production
version: ${{ github.sha }}
description: "Deployed ${{ github.repository }} to production"