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 Type | Load Mode |
|---|---|
| Markdown files (.md) | Always loaded |
| dbt models, metrics, sources | Intelligent |
| dbt seeds | Intelligent |
| LookML views, models, explores | Intelligent |
| dbt macros and tests | Disabled 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
| Field | Description |
|---|---|
alwaysApply | Include in every agent run |
references | Tables or topics this instruction relates to |
status | draft, suggested, approved, rejected |
category | general, 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
| Endpoint | Purpose |
|---|---|
/api/git/{repo_id}/sync | Create draft builds from branches |
/api/tests/runs/batch | Execute test suites |
/api/tests/runs/{run_id}/status | Check evaluation results |
/api/builds/{build_id}/publish | Promote builds to production |
Required Configuration
GitHub Secrets:
MC_API_KEY— MetricChat API keyREPO_ID— Repository identifierSUITE_ID— Test suite identifier
GitHub Variables:
METRICCHAT_URL— Your MetricChat instance URL