GitHub Actions Integration
Integrate Cloudgeni security scanning into your GitHub Actions workflows to automatically check Infrastructure as Code for security issues on every push and pull request.What You'll Get
- Automated security scanning in your CI/CD pipeline - PR status checks that block insecure code - Inline annotations showing issues directly in diffs - Fail-on-severity configuration for quality gates - SARIF upload for GitHub Security tab integration
Prerequisites
Before You Start
Before You Start
- GitHub repository with Actions enabled - Cloudgeni account and API key - Repository containing
IaC files (
.tf,.bicep,.hcl,.yaml, etc.)
Quick Start
Step 1: Create API Key
- Go to Settings → API Keys in Cloudgeni
- Click Create API Key
- Name it
github-actions - Copy the generated key
Step 2: Add Repository Secret
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
CLOUDGENI_API_KEY - Value: Your API key from Step 1
- Click Add secret
Step 3: Create Workflow
Create.github/workflows/cloudgeni.yml:
Configuration Options
Action Inputs
| Input | Description | Default |
|---|---|---|
api-key | Cloudgeni API key | Required |
fail-on-critical | Fail if critical findings | true |
fail-on-high | Fail if high severity findings | false |
fail-on-medium | Fail if medium severity findings | false |
scan-path | Directory to scan | . |
exclude | Paths to exclude (comma-separated) | - |
output-format | Output format (text, json, sarif) | text |
Basic Workflow
Strict Mode
Custom Path
Workflow Examples
Basic PR Workflow
Production Workflow
Multi-Environment Workflow
Terraform Plan Integration
GitHub Security Integration
SARIF Upload
Upload results to GitHub Security tab:PR Annotations
The action automatically adds annotations to PRs showing:- Finding location (file and line)
- Severity level
- Description and remediation
Branch Protection
Required Status Checks
- Go to Settings → Branches
- Click Add rule for your target branch
- Enable Require status checks to pass
- Search for and select
Cloudgeni Security Scan - Save changes
Organization Secrets
For multiple repositories:- Go to Organization Settings → Secrets and variables → Actions
- Click New organization secret
- Add
CLOUDGENI_API_KEY - Select repository access policy
- All selected repositories can use the secret
Troubleshooting
Common Issues
Common Issues
Secret Not Found:
- Verify secret name matches exactly
- Check secret is available to the repository
- Ensure workflow has correct permissions
- Large repositories take longer
- Consider scanning specific paths
- Check for large binary files
- Verify IaC files exist in scan path
- Check file extensions are supported
- Review exclude patterns
- Ensure
security-events: writepermission - Check SARIF file was generated
- Verify file path is correct