Skip to main content

GitHub

Health CheckPlaybookScraper

Mission Control integrates with GitHub to monitor repositories and trigger workflows.


Health Check

Use cases:

  • Query repository data including commits, pull requests, and issues
  • Monitor GitHub Actions workflow status
  • Track repository health and security status

Repository Query

Query GitHub repositories and validate results.

github-health-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: github-check
spec:
interval: 300
github:
- name: open-prs
githubToken:
valueFrom:
secretKeyRef:
name: github-credentials
key: token
query: |
SELECT count(*) as pr_count
FROM github_pull_requests('owner/repo')
WHERE state = 'open'
test:
expr: results[0].pr_count < 50 # Alert if too many open PRs

Playbook

Use cases:

  • Dispatch workflows from playbooks for CI/CD automation
  • Trigger new GitHub Actions runs based on events
  • Automate deployment pipelines

Dispatch Workflow

github-playbook-action.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: deploy-via-github
spec:
parameters:
- name: environment
label: Target Environment
type: list
properties:
options:
- staging
- production
actions:
- name: trigger-deploy
github:
repo: owner/deployment-repo
token:
valueFrom:
secretKeyRef:
name: github-credentials
key: token
workflow: deploy.yml
ref: main
inputs:
environment: "{{.params.environment}}"
Workflow with Parameters
github-workflow-params.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: run-tests
spec:
on:
config:
- types:
- Kubernetes::Deployment
changes:
- change_type: CREATE
actions:
- name: trigger-integration-tests
github:
repo: owner/test-repo
workflow: integration-tests.yml
ref: main
inputs:
namespace: "{{.config.config.metadata.namespace}}"
deployment: "{{.config.name}}"

Scraper

Use cases:

  • Scrape repository configurations and metadata into the catalog
  • Track repository settings and branch protection rules
  • Monitor organization membership and access
github-scraper.yaml
apiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: github-repos
spec:
schedule: "@every 6h"
github:
- organization: your-org
personalAccessToken:
valueFrom:
secretKeyRef:
name: github-credentials
key: token
repositories:
- include: "*"

Next Steps