Environment
The scanner reads the following environment variables. Tokens are only read
from env vars - never from CLI flags - so they never land in shell history,
CI logs, or –help output.
Authentication (MR/PR commenting)
| Variable | Used by | Purpose |
|---|---|---|
ANSIBLE_ | –gh-comment | Highest-precedence GitHub token. Use when you want a scanner-specific token separate from the workflow’s default GITHUB_. |
GITHUB_ | –gh-comment | The default token GitHub Actions injects into every workflow. Needs pull-requests: write. |
GH_ | –gh-comment | Alternative name some workflows use; same semantics as GITHUB_. |
ANSIBLE_ | –gl-comment | Highest-precedence GitLab token. |
GITLAB_ | –gl-comment | Personal access token or project access token with api scope. |
CI_ | –gl-comment | The token GitLab CI injects automatically. Works for the project’s own MRs without extra setup. |
Platform detection (set automatically by GitHub Actions / GitLab CI)
The scanner detects which platform it’s running on by reading these. You don’t set them manually; they’re populated by your CI runner.
| Variable | Platform | What it tells the scanner |
|---|---|---|
GITHUB_, GITHUB_, GITHUB_, GITHUB_, GITHUB_, GITHUB_, GITHUB_ | GitHub | This is a GitHub Actions PR run. GITHUB_ makes GitHub Enterprise transparent. |
CI_, CI_, CI_, CI_, CI_, CI_ | GitLab | This is a GitLab MR pipeline. CI_ makes self-hosted GitLab transparent. |
Default overrides
These let you set defaults once (e.g. in a CI image, container, or shell profile) instead of repeating flags on every invocation. CLI flags always win - env vars only fill in defaults that the CLI didn’t set.
| Variable | Equivalent CLI flag | Notes |
|---|---|---|
ANSIBLE_ | –directory | Default scan root. |
ANSIBLE_ | –format | One of markdown, json, xml, yaml, csv, html, junit, sarif, gl-sast, cyclonedx. |
ANSIBLE_ | –output | Output file path; format is inferred from the extension. |
ANSIBLE_ | –allowlist | Path to allowlist YAML. |
ANSIBLE_ | –jobs / -j | Worker thread count. Must be a positive integer. |
ANSIBLE_ | –severity | One of CRITICAL, HIGH, MEDIUM, LOW. |
ANSIBLE_ | –select | Run ONLY the listed rules (comma-separated, fnmatch globs supported). |
ANSIBLE_ | –ignore | Drop the listed rules (comma-separated, fnmatch globs supported). |
ANSIBLE_ | –exit-zero | Set to 1 / true / yes to always exit 0. |
–changed-files env-var lookup
–changed-files accepts either:
- a literal list of file paths (newline-, space-, or comma-separated), or
- a
$VAR_form that reads the named environment variable at runtime.NAME
Only files ending in ., ., ., or . are kept - anything
else in the diff (Python, Markdown, JSON, lockfiles) is silently passed
through, so you can feed raw git diff output without pre-filtering.
Real-world recipes
The flag is delimiter-agnostic, so the simplest pattern is to pipe whatever your platform gives you straight in:
| Scenario | Command |
|---|---|
| Pre-commit (only staged files) | git diff –cached –name-only –diff-filter=ACMR |
Local feature branch vs main | git diff –name-only origin/main. |
| PR / MR vs the merge target | git diff –name-only “origin/$TARGET_ |
| Last commit only (push hook) | git diff –name-only HEAD~1 HEAD |
Promotion staging -> production | git diff –name-only origin/staging. |
Note the three dots (A.): that’s “everything reachable from B that
isn’t on A’s side of the merge base” - i.e. the diff a reviewer sees on the
PR/MR, not the temporary state of the working tree. Use two dots (A.)
only if you specifically want “B minus A as of right now”.
CI/CD variable form
Most CI providers expose changed-file lists as variables; the $VAR form
keeps long lists out of shell history and avoids re-shelling-out to git:
The single-quote form is important - your shell would otherwise expand
$VAR before the scanner sees it.
| Platform | Variable | Notes |
|---|---|---|
| GitLab CI (MR pipelines) | $CI_ | Newline-separated; GitLab-managed. |
| GitHub Actions | (no native var) | Use git diff –name-only “${{ github.. |
| Bitbucket Pipelines | (no native var) | Same - diff against $BITBUCKET_. |
| Jenkins (Multibranch) | CHANGE_ | Diff against origin/$CHANGE_. |
| Azure DevOps | $(System. | Diff against that branch. |
For platforms without a native variable, set one yourself in a before_
and pass it through:
Interaction with MR-comment auto-scoping
When –mr-comment is enabled, the scanner already auto-scopes to the merge
request’s changed files (via the platform API). Passing –changed-files
explicitly wins - use it when you want to scan a narrower or wider list
than what the platform reports, e.g. to add group_ files that the MR
author didn’t touch but that affect the playbooks they did. To opt out of
auto-scoping entirely, pass –no-mr-comment-scope-changed-files.