Skip to content

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.

name: API tests
on: [pull_request]
jobs:
recon:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: robertguss/recon@v0.3.2
with:
env: staging

This 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.

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.

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.

The action has two steps.

  1. Uses the version input as the tag. If it is latest, reads tag_name from https://api.github.com/repos/robertguss/recon/releases/latest, sending github-token as 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.”

  2. Picks the release target from the runner:

    RUNNER_OS / RUNNER_ARCH Target
    Linux / X64 x86_64-unknown-linux-gnu
    macOS / ARM64 aarch64-apple-darwin
    macOS / X64 x86_64-apple-darwin

    Any other runner, including Windows and Linux ARM64, fails with “Unsupported runner platform”.

  3. Downloads SHA256SUMS.txt and recon-<tag>-<target>.tar.gz from the GitHub Release.

  4. Looks up the archive’s SHA-256 in SHA256SUMS.txt and compares it with sha256sum (or shasum -a 256). A missing entry or a mismatch fails the step.

  5. Extracts recon into $RUNNER_TEMP/recon-bin and adds that directory to GITHUB_PATH, so later steps in the job can also 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):

Terminal window
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):

Terminal window
recon --workspace <workspace> drift [--fail-on-breaking] [--sarif <sarif>]

Branch diff (mode branch-diff or all, or any mode when base-ref is set):

Terminal window
recon --workspace <workspace> diff-branch <base-ref> --markdown [--fail-on-breaking] > $RUNNER_TEMP/recon-branch-diff.md

When 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).

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.

name: API tests
on: [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 gate
on: [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 }}
- uses: robertguss/recon@v0.3.2
with:
mode: drift
fail-on-breaking: 'false'
sarif: recon-drift.sarif
- uses: robertguss/recon@v0.3.2
with:
version: latest

The action’s own ref (@v0.3.2) selects the version of action.yml; the version input selects the recon binary it downloads.

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 verify

For the reports themselves, see Send & Test (JUnit and Markdown), Drift & Branch Diff (SARIF and branch diff) and PII Airlock & Receipts (the salt).