GitHub Actions
Add MergeGuide policy checks to your GitHub Actions workflows.Quick Start
Add this workflow to.github/workflows/mergeguide.yml:
Using the Official Action
Use the official MergeGuide GitHub Action for simpler setup:Action Inputs
| Input | Description | Required | Default |
|---|---|---|---|
api-key | MergeGuide API key | Yes | - |
fail-on-warnings | Fail if warnings found | No | false |
policies | Comma-separated policy IDs | No | All enabled |
config-file | Path to config file | No | .mergeguide.yaml |
sarif-output | Output SARIF file | No | - |
Action Outputs
| Output | Description |
|---|---|
passed | true if all checks passed |
violations-count | Number of violations found |
evaluation-id | ID of the evaluation |
Workflow Examples
Basic PR Check
Check with Branch Protection
Security Scanning with SARIF
Scheduled Compliance Scan
Matrix Strategy for Multiple Languages
Setting Up Secrets
- Go to your repository’s Settings > Secrets and variables > Actions
- Click New repository secret
- Name:
MERGEGUIDE_API_KEY - Value: Your MergeGuide API key
- Click Add secret
Organization-Level Secrets
For multiple repositories, use organization secrets:- Go to organization Settings > Secrets and variables > Actions
- Create
MERGEGUIDE_API_KEY - Set repository access policy
Branch Protection Rules
Require MergeGuide checks to pass:- Go to repository Settings > Branches
- Add or edit branch protection rule for
main - Enable “Require status checks to pass”
- Search for and select “MergeGuide Check”
- Save changes
Caching for Faster Builds
Cache the CLI installation:Troubleshooting
Check Not Running
- Verify workflow file is in
.github/workflows/ - Check workflow triggers match your use case
- Verify YAML syntax is valid
Authentication Errors
- Verify
MERGEGUIDE_API_KEYsecret is set - Check API key hasn’t expired
- Ensure key has required scopes