---
title: "GitHub Actions workflow | Grafana Labs"
description: "Example workflow that regenerates dashboard JSON for Git Sync"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

## 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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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

| Step                         | Purpose                                                                                   |
|------------------------------|-------------------------------------------------------------------------------------------|
| **Checkout**                 | Access your repository code                                                               |
| **Set up Go**                | Install the language runtime for your SDK code (use Node setup instead for TypeScript)    |
| **Generate JSON**            | Run your SDK program and write dashboard files into the synced path (here, `dashboards/`) |
| **Check JSON is up to date** | On 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.
