CodeAnt Quality Gate Scan Action
This GitHub Action runs CodeAnt CI quality gate scan with secret detection and code quality analysis on your repository. It integrates seamlessly with your CI/CD pipeline to provide automated scanning and will fail your workflow if secrets are detected or quality gates fail. You can find this action on the GitHub Marketplace.Features
- π Secret detection and security scanning
- π Code quality gate enforcement
- π Fast and efficient scanning
- π Seamless CI/CD integration
- π Detailed reports and insights
- β±οΈ Configurable polling and timeout
- β Pass/Fail workflow status based on scan results
Inputs
Setup
Connect your repository to CodeAnt, then configure its quality gates under Settings β Code Analysis β Quality Gates.Usage
Save the complete workflow examples in.github/workflows/codeant-quality-gate.yml, or add the action steps to an existing job with contents: read permission.
Basic Example
.github/workflows/codeant-quality-gate.yml
With Custom Configuration
.github/workflows/codeant-quality-gate.yml
Complete Workflow Example
.github/workflows/codeant-quality-gate.yml
How It Works
- Checkout: Checks out your repository code
- Fetch Script: Downloads the quality gates scanning script from CodeAnt API
- Start Scan: Initiates the quality gate scan on CodeAnt servers
- Poll Results: Continuously polls for scan results until completion or timeout
- Report Status: Reports pass/fail status with GitHub annotations
Expected Output
When Quality Gate Passes:β Quality Gate PASSED - No secrets detectedThe workflow continues successfully. When Quality Gate Fails:
β Quality Gate FAILED - Secrets detected or scan errorThe workflow fails, preventing merge/deployment.
Quality Gate Checks
Currently, the quality gate performs the following checks:Security and Code Quality Checks
- Secret Detection: Scans for hardcoded secrets, API keys, passwords, and tokens
- SAST (Static Application Security Testing): Detects security vulnerabilities in source code
- SCA (Software Composition Analysis): Identifies vulnerabilities in third-party dependencies
- IaC (Infrastructure as Code): Scans infrastructure configuration files for security issues
- Duplicate Code Detection: Identifies code duplication to improve maintainability
- Analyzes only the changed lines since your merge base commit
- Uses high-confidence detection to minimize false positives
- Blocks the build if any issues are found
Best Practices
- Run on all branches: Quality gates should run on every push to catch issues early
- Block merges: Configure branch protection rules to require quality gate checks before merging
- Review failures: When quality gates fail, review the detected issues immediately
- Keep tokens secure: Never commit access tokens directly - always use GitHub Secrets
Troubleshooting
Quality gate times out
If the scan takes longer than expected:- Increase the timeout using
timeout: 600(10 minutes) - Check if the CodeAnt service is operational
Authentication failures
If you see βAccess token invalidβ:- Pass
${{ secrets.GITHUB_TOKEN }}from the running job and give the jobcontents: read. - Confirm the CodeAnt GitHub App has access to the repository.
- If using the fallback, check that
CODEANT_TOKENis active and has the Codeant CI/CD role and repository access.
No results returned
If the scan completes but returns no results:- Check that quality gates are enabled for your repository in CodeAnt
- Verify the commit SHA is correct
License
This project is licensed under the MIT License - see the LICENSE file for details.Support
For issues, questions, or contributions, please visit the GitHub repository.Use a CodeAnt token as a fallback
If the built-in token is unavailable, create a CodeAnt token with the Codeant CI/CD role and repository access. Save it as the GitHub Actions secretCODEANT_TOKEN and replace the input: