- Documentation
- Learning Hub
- Section 4 of 5 CI/CD automation
GitHub Actions workflow
Example workflow
This example uses GitHub Actions to regenerate dashboard JSON whenever you open a pull request or push to main. On a pull request it fails if the JSON files in the repo do not match what the generator produces, so reviewers know the committed files are current. After merge, Git Sync (not this workflow) updates Grafana from the repository.
Adapt the generate command and output path to match your project. The pattern is what matters: generate in CI, review JSON on the PR, let Git Sync sync after merge.
name: Generate Grafana dashboards
on:
push:
branches: [main]
pull_request:
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Generate dashboard JSON
run: go run ./cmd/generate
- name: Check JSON is up to date
if: github.event_name == 'pull_request'
run: |
git add -N dashboards || true
git diff --exit-code -- dashboardsStep breakdown
There is no Terraform apply step and no gcx push in this happy path. After merge, the JSON on the synced branch is what Git Sync reads.
Alternative CI systems
You can translate the same stages to GitLab CI, CircleCI, or Jenkins. Your Foundation SDK code stays the same; only the pipeline syntax changes.