GitHub Integration
Enforce policies on pull requests, branches, and commits with GitHub integration.
Overview
The GitHub integration connects Aguardic to your GitHub repositories via a GitHub App. When pull requests are opened or updated, Aguardic evaluates the changes against your policies and reports results as check runs.
Setup
Install the GitHub App
Go to Integrations > GitHub in the Aguardic dashboard and click Connect. You'll be redirected to GitHub to install the Aguardic GitHub App. Select the repositories you want to govern and authorize the installation.
Bind policies
After connecting, go to Policy Bindings and map your policies to the GitHub integration. You can bind policies to:
main or productionConfigure enforcement
Choose how Aguardic enforces policy results on GitHub:
failure), preventing merge with branch protectionaction_required), requiring manual approval before mergeneutral) but includes violation details in the check summaryHow It Works
PR opened or updated
Webhook received
Fetch PR data
Policy evaluation
Report results
What Gets Evaluated
Branch Protection
For full enforcement, enable branch protection rules on GitHub:
- Go to Repository Settings > Branches > Branch protection rules
- Enable "Require status checks to pass before merging"
- Select the Aguardic check from the list
With branch protection enabled and enforcement set to BLOCK, developers cannot merge PRs that violate your policies.
Example Policies
Require PR Description
Ensure all PRs have a meaningful description:
- Field:
description - Operator:
MATCHES - Value:
.{20,}(at least 20 characters) - Severity: MEDIUM
Block Secret Commits
Prevent credentials from being committed:
- Field:
content - Operator:
MATCHES - Value:
(AKIA[A-Z0-9]{16}|sk-[a-zA-Z0-9]{48}|ghp_[a-zA-Z0-9]{36}) - Severity: CRITICAL
Next Steps
- GitLab Integration — Similar setup for GitLab
- Your First Policy — Deep dive into policy creation