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.yamlapiVersion: 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.yamlapiVersion: 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.yamlapiVersion: 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
The following scraper example imports GitHub repositories into the catalog. The repo field supports exact repository names and collections.MatchItems selectors, so you can scan a group of repositories without listing every repository.
github-repo-selectors.yamlapiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: github-repo-selectors
spec:
schedule: '@every 6h'
github:
- repositories:
# Repo selectors use collections.MatchItems syntax and are resolved
# against all visible, non-archived repositories for the owner.
- owner: flanksource
repo: config-db,mission-control
# Overlapping selectors are deduped per GitHub scraper config.
- owner: flanksource
repo: '*control'
# Exact repositories can be mixed with selectors.
- owner: flanksource
repo: duty