Slide 2 of 4

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.

YAML
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 -- dashboards

Step breakdown

StepPurpose
CheckoutAccess your repository code
Set up GoInstall the language runtime for your SDK code (use Node setup instead for TypeScript)
Generate JSONRun your SDK program and write dashboard files into the synced path (here, dashboards/)
Check JSON is up to dateOn pull requests, fail if generated output differs from what the branch commits

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.