> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Actions

> Scan your repository and download results from GitHub Actions.

Run full repository scans. To enforce security policies before deployment, use the [CI security pipeline example](https://docs.codeant.ai/control_center/ci/github-security-pipeline.md).

## 1. Connect your repository

Connect your repository and enable SAST, SCA, and secrets in [Analysis Configuration](https://docs.codeant.ai/repositories/analysis_configuration.md).

## 2. Add the workflow

Save as `.github/workflows/codeant-scan.yml`. Replace `main` with your target branch.

```yaml .github/workflows/codeant-scan.yml expandable theme={"theme":"css-variables"}
name: CodeAnt full repository scan

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  scan:
    if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
    runs-on: ubuntu-latest
    timeout-minutes: 25
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha || github.sha }}
          persist-credentials: false
      - name: Run CodeAnt scan
        uses: CodeAnt-AI/codeant-ci-scan-action@v0.0.6
        with:
          access_token: ${{ secrets.GITHUB_TOKEN }}
          scanners: sast,sca,secrets
          scan_timeout: '1200'
      - name: Save reports
        if: ${{ always() }}
        uses: actions/upload-artifact@v4
        with:
          name: codeant-results
          retention-days: 14
          if-no-files-found: error
          path: |
            results.json
            codeant.sarif
            codeant-qg.xml
```

To block deployment, [configure full-code quality gates](https://docs.codeant.ai/control_center/ci/github-security-pipeline.md) and set `quality_gate: 'true'`.

This example skips fork PRs and scans commits from the connected repository.

## 3. Run and download

1. Merge the workflow onto your default branch.
2. Open **Actions → CodeAnt full repository scan → Run workflow**.
3. Open the completed run. Under **Artifacts**, download **codeant-results**.

The archive contains JSON findings, SARIF, and JUnit XML. The action does not generate CSV/PDF.

## Inputs

| Input | Set it to | Default |
| - | - | - |
| `access_token` | `${{ secrets.GITHUB_TOKEN }}`; required | None |
| `scanners` | `sast`, `sca`, `secrets`, `iac`, `antipatterns`, or `all`; comma-separated | `sast,sca` |
| `quality_gate` | `'true'` to fail when configured quality gates fail or results time out | `'false'` |
| `scan_timeout` | Seconds to wait for results | `300` |
| `include_paths` | Patterns such as `src/**,lib/**` | All files |
| `exclude_paths` | Patterns such as `tests/**,vendor/**` | None |
| `api_base` | Your CodeAnt API URL | `https://api.codeant.ai` |

Enable the selected analyses in CodeAnt; `scanners` selects returned results. `antipatterns` returns duplicate-code results. Include patterns take precedence over exclusions.

## Use a CodeAnt token as a fallback

If the built-in token is unavailable, [create a CodeAnt token](https://docs.codeant.ai/settings/api-tokens.md#create-a-token) with the **Codeant CI/CD** role and repository access. Save it as the GitHub Actions secret `CODEANT_TOKEN` and replace the input:

```yaml theme={"theme":"css-variables"}
access_token: ${{ secrets.CODEANT_TOKEN }}
```

## Runner data flow

The runner sends the token, repository, commit, branch, provider URL, and file filters to CodeAnt over HTTPS. CodeAnt fetches the repository server-side and returns reports. The action does not upload the runner's source checkout or local Docker image.

## Troubleshooting

| Error | Action |
| - | - |
| `401` | Pass `${{ secrets.GITHUB_TOKEN }}` from the running job. If using the fallback, check that `CODEANT_TOKEN` exists and is active. |
| `403` | Check job permissions and the CodeAnt GitHub App’s access to the repository. For the fallback, check the CodeAnt token’s role and repository scope. |
| Incomplete results | Enable the required analyses and increase `scan_timeout`. |
| No artifacts | Open the failed scan step's logs. Early failures may produce no reports. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.