GitHub Action
The Recon repository root contains action.yml, a composite GitHub Action named “Recon API Test & Drift Gate”. It downloads a verified recon release binary, then runs recon test, recon drift and/or recon diff-branch against a workspace in your repository, and writes the results to the job’s step summary. Use it to fail a pull request when API tests fail, when code drifts from your collections, or when a branch introduces breaking API changes.
Quick example
Section titled “Quick example”name: API testson: [pull_request]
jobs: recon: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: robertguss/recon@v0.3.2 with: env: stagingThis runs recon test --env staging on the workspace at the repository root, writes recon-junit.xml, and appends a Markdown test summary to the job summary. The step fails if any test fails.
Inputs
Section titled “Inputs”All inputs are optional.
| Input | Default | Meaning |
|---|---|---|
version |
v0.3.2 |
Release tag to download, for example v0.3.2, or latest. |
workspace |
. |
Path to the Recon workspace (the directory with .recon.toml). Passed as --workspace. |
env |
local |
Environment name passed to recon test --env. |
mode |
test |
Which commands to run: test, drift, branch-diff, both (test and drift) or all (test, drift and branch-diff). |
base-ref |
'' |
Git ref for recon diff-branch. Setting it runs branch-diff in every mode. |
filter |
'' |
Request filter passed to recon test as its [FILTER] argument. |
data |
'' |
CSV or JSONL dataset passed as recon test --data. |
openapi-spec |
'' |
OpenAPI 3.0 / 3.1 spec passed as recon test --openapi-spec. |
junit |
recon-junit.xml |
Path for the JUnit XML report (recon test --junit). Set to '' to skip it. |
sarif |
recon-drift.sarif |
Path for the SARIF 2.1.0 drift report (recon drift --sarif). Set to '' to skip it. |
fail-on-breaking |
'true' |
When 'true' (or empty), adds --fail-on-breaking to both recon drift and recon diff-branch. Any other value, such as 'false', leaves it off. |
maskkeel-salt |
recon-ci-salt |
Exported as MASKKEEL_SALT, the salt for PII Airlock masking (the same as the global --salt flag). |
github-token |
${{ github.token }} |
Sent as a bearer token when resolving version: latest through the GitHub API. |
Unknown mode values do not cause an error. With an unknown mode and no base-ref, the run step does nothing and succeeds.
The data, openapi-spec, junit and sarif paths are resolved against the step’s working directory (the repository root by default), not against workspace. See Send & Test.
Outputs
Section titled “Outputs”| Output | Set when | Value |
|---|---|---|
junit-path |
Test mode ran and junit is not empty. |
The junit input. |
markdown-summary-path |
Test mode ran and the summary file exists. | $RUNNER_TEMP/recon-summary.md |
sarif-path |
Drift mode ran and sarif is not empty. |
The sarif input. |
branch-diff-summary-path |
Branch-diff ran. | $RUNNER_TEMP/recon-branch-diff.md |
junit-path and sarif-path are set before the command runs, so they are set even if recon fails before writing the file.
What the action runs
Section titled “What the action runs”The action has two steps.
Step 1: Install Recon CLI
Section titled “Step 1: Install Recon CLI”-
Uses the
versioninput as the tag. If it islatest, readstag_namefromhttps://api.github.com/repos/robertguss/recon/releases/latest, sendinggithub-tokenas a bearer token when it is set. If no tag comes back, it fails with “Failed to resolve latest Recon release tag from GitHub API.” -
Picks the release target from the runner:
RUNNER_OS/RUNNER_ARCHTarget Linux/X64x86_64-unknown-linux-gnumacOS/ARM64aarch64-apple-darwinmacOS/X64x86_64-apple-darwinAny other runner, including Windows and Linux ARM64, fails with “Unsupported runner platform”.
-
Downloads
SHA256SUMS.txtandrecon-<tag>-<target>.tar.gzfrom the GitHub Release. -
Looks up the archive’s SHA-256 in
SHA256SUMS.txtand compares it withsha256sum(orshasum -a 256). A missing entry or a mismatch fails the step. -
Extracts
reconinto$RUNNER_TEMP/recon-binand adds that directory toGITHUB_PATH, so later steps in the job can also runrecon.
Step 2: Run Recon
Section titled “Step 2: Run Recon”The step runs with set -uo pipefail but without set -e, so every selected command runs even if an earlier one fails.
Test (mode test, both or all):
recon --workspace <workspace> test --env <env> \ [--junit <junit>] --markdown-summary $RUNNER_TEMP/recon-summary.md \ [--data <data>] [--openapi-spec <openapi-spec>] [<filter>]The Markdown summary is then appended to $GITHUB_STEP_SUMMARY.
Drift (mode drift, both or all):
recon --workspace <workspace> drift [--fail-on-breaking] [--sarif <sarif>]Branch diff (mode branch-diff or all, or any mode when base-ref is set):
recon --workspace <workspace> diff-branch <base-ref> --markdown [--fail-on-breaking] > $RUNNER_TEMP/recon-branch-diff.mdWhen base-ref is empty, the base ref is origin/main. The Markdown report is appended to $GITHUB_STEP_SUMMARY.
Result. The step exits with the first non-zero exit code in the order test, drift, branch-diff, or 0 if all succeeded. Exit code 1 means a check failed; 2 means recon could not run. See Output Formats & Exit Codes.
Because stdout is not a terminal in Actions, recon test and recon drift print JSON to the log (the auto format resolves to agent).
Artifacts
Section titled “Artifacts”| Artifact | Produced by | Where it ends up |
|---|---|---|
| Test summary (Markdown) | Test mode | Appended to the job’s step summary. Format: Send & Test. |
| JUnit XML | Test mode with junit set |
Written to the junit path. The action does not upload it. |
| SARIF 2.1.0 | Drift mode with sarif set |
Written to the sarif path. The action does not upload it. |
| Branch diff (Markdown) | Branch-diff | Appended to the job’s step summary. |
To keep the JUnit or SARIF files, add your own steps after the action, as in the examples below.
Examples
Section titled “Examples”Tests with a dataset and an OpenAPI check
Section titled “Tests with a dataset and an OpenAPI check”name: API testson: [pull_request]
jobs: recon: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- id: recon uses: robertguss/recon@v0.3.2 with: workspace: api env: staging filter: Students data: api/fixtures/students.csv openapi-spec: api/openapi.yaml junit: reports/recon-junit.xml
- if: always() uses: actions/upload-artifact@v4 with: name: recon-junit path: ${{ steps.recon.outputs.junit-path }}Test, drift and branch diff on every pull request
Section titled “Test, drift and branch diff on every pull request”recon diff-branch reads the base ref with git ls-tree and git show, so the base branch must be present in the clone. A full-history checkout provides it.
name: API gateon: [pull_request]
permissions: contents: read security-events: write
jobs: recon: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0
- id: recon uses: robertguss/recon@v0.3.2 with: mode: all env: staging base-ref: origin/main fail-on-breaking: 'true'
- if: always() uses: github/codeql-action/upload-sarif@v3 with: sarif_file: ${{ steps.recon.outputs.sarif-path }}Drift report only, never failing the job
Section titled “Drift report only, never failing the job”- uses: robertguss/recon@v0.3.2 with: mode: drift fail-on-breaking: 'false' sarif: recon-drift.sarifAlways use the newest release
Section titled “Always use the newest release”- uses: robertguss/recon@v0.3.2 with: version: latestThe action’s own ref (@v0.3.2) selects the version of action.yml; the version input selects the recon binary it downloads.
Using Recon in other workflow steps
Section titled “Using Recon in other workflow steps”Because the install step adds recon to GITHUB_PATH, you can run any command after the action:
- uses: robertguss/recon@v0.3.2 with: mode: drift- run: recon --workspace . airlock verifyFor the reports themselves, see Send & Test (JUnit and Markdown), Drift & Branch Diff (SARIF and branch diff) and PII Airlock & Receipts (the salt).