MetricChat
Guides

Git Integration

Manage your instructions as code with Git integration and CI/CD automation.

Why Git Integration?

Treating analytics knowledge as code provides:

  • Version control — Complete history of all changes
  • Peer review — Review instructions before deployment
  • Automated testing — Run evaluations on every pull request
  • Single source of truth — One canonical set of instructions
  • Collaboration — Cross-functional teams contribute together

Supported Repository Content

MetricChat integrates with Git repositories containing:

Content TypeLoad Mode
Markdown files (.md)Always loaded
dbt models, metrics, sourcesIntelligent
dbt seedsIntelligent
LookML views, models, exploresIntelligent
dbt macros and testsDisabled by default

Markdown Instructions

Create .md files with YAML frontmatter to control how instructions are loaded:

---
alwaysApply: true
references: ["orders", "revenue"]
status: approved
category: code_gen
---

# Revenue Calculation

Revenue should always be calculated as `order_total - discounts - returns`.
Never include tax in revenue calculations unless explicitly requested.

Frontmatter Fields

FieldDescription
alwaysApplyInclude in every agent run
referencesTables or topics this instruction relates to
statusdraft, suggested, approved, rejected
categorygeneral, code_gen, visualization, dashboard, system

GitHub Actions CI/CD

Automate instruction deployment with GitHub Actions:

On Pull Requests

Sync the branch, run evaluations, and post results as PR comments.

On Merge to Main

Publish the build to production.

Example Workflow

name: MetricChat CI/CD
on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  sync-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Sync branch
        run: |
          curl -X POST "${{ vars.METRICCHAT_URL }}/api/git/${{ secrets.REPO_ID }}/sync" \
            -H "Authorization: Bearer ${{ secrets.MC_API_KEY }}" \
            -H "Content-Type: application/json" \
            -d '{"branch": "${{ github.head_ref }}"}'

      - name: Run evaluations
        if: github.event_name == 'pull_request'
        run: |
          curl -X POST "${{ vars.METRICCHAT_URL }}/api/tests/runs/batch" \
            -H "Authorization: Bearer ${{ secrets.MC_API_KEY }}" \
            -H "Content-Type: application/json" \
            -d '{"suite_id": "${{ secrets.SUITE_ID }}"}'

      - name: Publish build
        if: github.ref == 'refs/heads/main'
        run: |
          curl -X POST "${{ vars.METRICCHAT_URL }}/api/builds/$BUILD_ID/publish" \
            -H "Authorization: Bearer ${{ secrets.MC_API_KEY }}"

API Endpoints

EndpointPurpose
/api/git/{repo_id}/syncCreate draft builds from branches
/api/tests/runs/batchExecute test suites
/api/tests/runs/{run_id}/statusCheck evaluation results
/api/builds/{build_id}/publishPromote builds to production

Required Configuration

GitHub Secrets:

  • MC_API_KEY — MetricChat API key
  • REPO_ID — Repository identifier
  • SUITE_ID — Test suite identifier

GitHub Variables:

  • METRICCHAT_URL — Your MetricChat instance URL

On this page