Skip to content

GitHub Integration Quick Reference

Connection Setup

Dashboard → Settings → GitHub Integration → Connect with OAuth

Personal Access Token

# 1. Create token at github.com/settings/tokens/new
# Required scopes: repo, read:org

# 2. In WhiteBoxXAI:
Dashboard → Settings → GitHub Integration → Connect with PAT

Configuration File

Create .whiteboxxai.yml in repository root:

enabled: true
model_patterns: ["models/**/*.pkl"]
storage_mode: metadata        # or "full" to store model files (needed for explanations)
model_type: random_forest     # xgboost, random_forest, neural_network, linear_model, llm, custom
framework: sklearn
features: [income, utilisation, tenure_months]

See GitHub → Configuration File for every key.

Webhook Events

WhiteBoxXAI processes these GitHub events: - push: Commit to tracked branch → Scan for model files - release: Release published → Register model version - create: Tag created → Link to model version

CLI Git Tracking

import os

from whiteboxxai import WhiteBoxXAI

client = WhiteBoxXAI(api_key=os.environ["WHITEBOX_API_KEY"])

# Automatic Git detection (requires GitPython)
client.models.register(
    name="fraud-detector",
    model_type="random_forest",
    framework="sklearn",
    version="1.0.0",
    features=["amount", "merchant_category", "hour"],
    baseline_metrics={},
    auto_detect_git=True,  # captures commit hash, branch and repository URL
)

API Endpoints

Endpoint Method Description
/github/oauth/authorize GET Initiate OAuth flow
/github/connect/pat POST Connect with PAT
/github/connections GET List connections
/github/connections/{id}/verify POST Verify connection
/github/repositories/track POST Track repository
/github/repositories/{id}/webhook POST Setup webhook

Common Issues

Q: Models not auto-registering? - Check .whiteboxxai.yml exists - Verify auto_register: true - Ensure model files match path patterns

Q: Webhook inactive? - Click "Setup Webhook" in UI - Requires admin access to repository

Q: Connection fails? - OAuth: Check redirect URI configuration - PAT: Verify repo and read:org scopes

Security

  • Tokens encrypted at rest (Fernet/AES-128)
  • Webhooks verified with HMAC-SHA256
  • Minimal permissions requested (repo, read:org)
  • OAuth tokens auto-refresh
  • Revoke access anytime in GitHub settings

Model Path Patterns

Default patterns (glob syntax):

**/*.pkl        # scikit-learn
**/*.h5         # Keras/TensorFlow
**/*.pt         # PyTorch
**/*.onnx       # ONNX
**/*.safetensors # Hugging Face

Override in .whiteboxxai.yml:

models:
  - path: "production/models/*.pkl"  # Specific folder only

Full Documentation

See the GitHub Integration guide for the complete walkthrough.