Pre-release. Parity is not publicly available yet: the CLI, the GitHub Action and the hosted workspace open at launch. The demo runs on example data.

Skip to content

GitHub Actions

Run Parity on every pull request — the action's inputs and outputs, a complete workflow that starts base and head, the job summary, artifacts, exit codes and branch protection.

The Parity action runs parity compare in a workflow job, writes the result to the job summary, uploads the reports as an artifact and fails the job according to your policy.

#Status

Parity is pre-release, and that affects how you use the action today:

  • The action lives in the action/ directory of the Parity repository. It is not published to the GitHub Marketplace, and the short name x1991labs/parity-action@v1 used below is the intended interface, not something you can reference yet.
  • By default the action downloads a release binary and verifies its checksum. No release has been published yet, so for now you build the CLI in the job and pass it with parity-path. A workflow you can run today shows how.

#The step

This is the interface the action is designed around:

yaml
- name: Check API behaviour
  uses: x1991labs/parity-action@v1
  with:
    baseline: http://localhost:8080
    candidate: http://localhost:8081
    config: parity.yaml

The action does not start your API. Earlier steps in the job start the two versions; the action compares them.

#Inputs

InputDefaultMeaning
baselinefrom the configurationURL of the baseline environment (the version you trust).
candidatefrom the configurationURL of the candidate environment (the version under review).
configparity.yamlPath to the configuration file.
working-directory.Directory to run in. Paths in the configuration resolve relative to the configuration file.
baseline-revisionpull request base SHA, or the previous commit on pushRevision recorded for the baseline.
candidate-revisionpull request head SHA, or the pushed commitRevision recorded for the candidate.
argsemptyExtra arguments for parity compare, e.g. --filter "workflow:*" --policy inconclusive=fail.
versionlatestRelease to install, e.g. v0.1.0. Ignored when parity-path is set.
parity-path—Path to an existing parity binary. Skips the download.
upload-artifacttrueUpload the JSON, HTML and JUnit reports as a workflow artifact.
artifact-nameparity-reportName of the artifact.
artifact-retention-days14How long GitHub keeps the artifact.
token—Project token for a hosted workspace. Optional; when empty the upload is skipped and the check still runs.
api-urlhttps://parity.x1991labs.comHosted workspace URL, when token is set.

#Outputs

OutputValue
verdictpass or fail.
exit-code0 pass · 1 behavioural changes · 2 environment errors · 3 configuration · 4 inconclusive.
changedNumber of scenarios with behavioural changes.
errorsNumber of scenarios that could not be executed.
inconclusiveNumber of inconclusive scenarios.
reportPath to the JSON report on the runner.

#A workflow you can run today

This job checks out the pull request's base and head, starts both, builds Parity from source and compares them. Adapt the two "start" steps to however your service starts.

yaml
name: API behaviour
on:
  pull_request:

permissions:
  contents: read

jobs:
  parity:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - name: Check out the base commit
        uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.base.sha }}
          path: base

      - name: Check out the pull request
        uses: actions/checkout@v4
        with:
          path: head

      - name: Check out Parity
        uses: actions/checkout@v4
        with:
          repository: x1991labs/parity
          ref: main # pin to a commit SHA
          path: parity

      - name: Build the Parity CLI
        run: cargo build --release --manifest-path parity/Cargo.toml -p parity-cli

      - uses: actions/setup-node@v4
        with:
          node-version: 22

      - name: Start the baseline
        working-directory: base
        run: |
          npm ci
          PORT=8080 npm start &

      - name: Start the candidate
        working-directory: head
        run: |
          npm ci
          PORT=8081 npm start &

      - name: Wait for both
        run: |
          for port in 8080 8081; do
            curl --silent --fail --retry 30 --retry-delay 1 --retry-connrefused "http://localhost:$port/health" > /dev/null
          done

      - name: Check API behaviour
        uses: ./parity/action
        with:
          working-directory: head
          baseline: http://localhost:8080
          candidate: http://localhost:8081
          config: parity.yaml
          parity-path: ${{ github.workspace }}/parity/target/release/parity

Notes:

  • The configuration and the scenarios are taken from the pull request (head), so a pull request can add scenarios for the behaviour it changes. If scenarios must not be editable by the pull request, set working-directory: base.
  • localhost is a local address, so mutating scenarios are allowed without further configuration. See the mutation guard.
  • Once releases exist, the three Parity steps collapse into the single step shown at the top.

#What the action does

  1. Install. Uses parity-path, or downloads the release archive for the runner's platform (Linux and macOS, x86-64 and arm64) and refuses to continue unless its SHA-256 matches the published checksums.txt.
  2. Compare. Runs parity compare --ci with --output, --html, --junit, --summary "$GITHUB_STEP_SUMMARY" and --outputs "$GITHUB_OUTPUT", plus your args.
  3. Upload reports. report.json, report.html and junit.xml are uploaded as one artifact — also when the comparison failed.
  4. Apply the policy. The job fails last, so the summary and the artifact exist even when the check does not pass.

Inputs reach the scripts through environment variables and are never interpolated into shell source, so a branch name or pull request title cannot inject commands. args is split into words but never evaluated.

#The job summary

The Markdown summary is appended to the job's summary page: a headline, the counts, the two environments with their revisions, and one collapsible table per changed scenario listing the step, the location and what changed.

## ✗ Parity — Behaviour changed in 14 of 89 scenarios

| Unchanged | Changed | Errors | Inconclusive | Skipped | Requests | Duration |
|---:|---:|---:|---:|---:|---:|---:|
| 73 | 14 | 0 | 2 | 0 | 209 | 0.0s |

With --ci on GitHub Actions the CLI also emits workflow annotations for the results.

#Exit codes and branch protection

The job's conclusion follows the CLI's exit code:

Exit codeJobMessage
0passesParity: no policy violation.
1failsBehaviour changed. Review the differences in the job summary.
2failsAn environment could not be reached. This is an execution failure, not a behavioural result.
3failsParity could not run. Check the configuration.
4failsThe comparison was inconclusive or compared nothing.

To stop a pull request from merging while its behaviour differs, make the job a required status check: in the repository settings, add a branch protection rule (or ruleset) for your default branch, require status checks to pass, and select the job (parity in the example above).

What should and should not block is a policy decision. For example, to block on inconclusive results too:

yaml
- name: Check API behaviour
  uses: x1991labs/parity-action@v1
  with:
    baseline: http://localhost:8080
    candidate: http://localhost:8081
    args: --policy inconclusive=fail

When a difference is intended, the check will keep failing until the baseline includes it, the scenario or an ignore rule is updated in the same pull request, or the policy for that job is relaxed. Parity has no notion of "approved" in the CLI; approvals are a hosted workspace feature and do not change the exit code.

#Recording revisions

Reports carry the revision deployed in each environment. The action fills them in from the event: base and head SHA on pull_request, previous and pushed commit on push. Set baseline-revision and candidate-revision when that is not what you deployed — for example when the baseline is the latest release tag.

The pull request number, repository, ref and a link to the workflow run are recorded as well.

#Pull requests from forks

Workflows triggered by pull_request from a fork run without secrets and with a read-only token. That is the safe default, and Parity is designed to work within it:

  • The comparison itself needs no secret when both versions run on the runner.
  • token will be empty. The action skips the upload and the check still runs and reports normally.
  • Do not switch to pull_request_target to get secrets into this job. It would run code from the fork — your API, its build scripts, the scenarios — with access to them.

If your API needs credentials to start, prefer throwaway values that exist only in the job. See untrusted pull requests.

#Pinning

Pin third-party actions to a full commit SHA rather than a branch or a moving tag, Parity included:

yaml
- uses: actions/checkout@v4
  with:
    repository: x1991labs/parity
    ref: 0123456789abcdef0123456789abcdef01234567
    path: parity

When release binaries exist, also pin version (for example v0.1.0) instead of latest, so a new release cannot change the result of an unrelated pull request.

    Loading the index…