Browse the docs

Gates and regression mode

Set how many issues a pull request may have, or block only the issues it introduces.

The gate decides whether a run passes. Set it with fail_on on GitHub or QUALITYGATE_FAIL_ON on GitLab and Bitbucket. QualityGate computes the decision on its own servers from the uploaded findings, so it cannot be changed from inside the CI job.

Absolute limits

The default, critical=0,serious=0, fails the run when the page has any critical or serious finding. Raise the numbers to tolerate some:

with:
  fail_on: critical=0,serious=5

Both critical and serious must be given. Moderate and minor findings are always reported and never fail a run.

Absolute limits suit new projects and sites that are already clean. On a site with existing issues, every pull request fails until all of them are fixed, which usually leads teams to switch the check off. Regression mode solves that.

Require complete asset coverage

For the secrets-exposure bundle, append complete-coverage to the thresholds. For example, use fail_on: critical=0,serious=0,complete-coverage in GitHub Actions, or the same value in QUALITYGATE_FAIL_ON in GitLab or Bitbucket. It also works with regression,complete-coverage.

The gate fails when an in-scope asset is skipped because it could not be read or a size or count limit was reached. Without this option, the existing severity thresholds determine the gate and the report still shows partial coverage with the count and reasons. Ignore rules can suppress findings but cannot hide this coverage notice. The rule still scans only the assets in the bundle’s documented scope. A bundle without a secrets-exposure result cannot satisfy this option.

Regression mode

fail_on: regression fails a run only for issues the pull request introduced. Existing issues are still reported; they just no longer decide the result.

with:
  fail_on: regression                 # no new critical or serious issues
  # fail_on: regression,critical=1    # allow one new critical issue
  # fail_on: regression,serious=3     # allow three new serious issues

The comment leads with what changed:

New in this pull request 3 · Existing 47 · Fixed in this pull request 5

Fixed issues are shown as progress and never fail a run.

fail_on_new: 'true' on GitHub, or QUALITYGATE_FAIL_ON_NEW: 'true' on GitLab and Bitbucket, is the same as regression mode: the limits in QUALITYGATE_FAIL_ON then count only new issues.

Recording a baseline

Regression mode compares a pull request with the baseline: the last result of the same page and bundle on the branch the pull request merges into. A baseline is recorded by a run on that branch itself, so add a push trigger for your default branch next to pull_request:

name: QualityGate

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read
  id-token: write

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - run: npx -y playwright@1.61.1 install --with-deps chromium
      - uses: QualityGateDev/scan-action@v1
        with:
          url: ${{ github.event_name == 'push' && 'https://www.example.com/' || format('https://pr-{0}.preview.example.com/', github.event.pull_request.number) }}
          fail_on: regression

On pushes to main the example scans production; on pull requests it scans the preview. Push runs post no comment and count as a normal run. On GitLab and Bitbucket, the default-branch pipeline plays the same role.

Comparing with another branch

By default a pull request is compared with the project’s default branch. To compare with another branch, such as develop, set baseline_branch on GitHub or QUALITYGATE_BASELINE_BRANCH on GitLab and Bitbucket, both on pull requests and on that branch’s own pipeline:

pipelines:
  pull-requests:
    '**':
      - step:
          script:
            - pipe: docker://ghcr.io/qualitygatedev/bitbucket-pipe@sha256:<digest>
              variables:
                # ...
                QUALITYGATE_FAIL_ON: regression
                QUALITYGATE_BASELINE_BRANCH: develop
  branches:
    develop:
      - step:
          script:
            - pipe: docker://ghcr.io/qualitygatedev/bitbucket-pipe@sha256:<digest>
              variables:
                # ...
                QUALITYGATE_BASELINE_BRANCH: develop

A run on develop with that variable records develop’s baseline. Runs on the default branch keep recording the default branch’s baseline, so both can exist side by side.

Changes since the previous run

QualityGate edits one comment per pull request rather than adding a new one, so a comment on its own would lose what the last run found. Each run is therefore also compared with the previous run of the same pull request, page, and bundle. The comment shows the result above the findings:

Since the previous run 0 new · 4 fixed · 12 still open

followed by a table of each severity before and after. The fixed and new issues are listed in the collapsed details. This comparison is for reading only: it never decides the verdict, which regression mode takes from the baseline. It appears in comments posted by the GitHub App, the Action, the GitLab runner, and the Bitbucket pipe from version 1.2.0.

How issues are matched

Findings are matched by a fingerprint of the rule and the element, computed from the page path rather than the full URL. A different preview hostname, a new wrapper div, or a renumbered sibling element is not treated as a new issue. The same page path with the same bundle is compared across hosts, so /pricing on a preview is compared with /pricing on production.

Before the first baseline

Until a baseline exists for a page and bundle, regression runs pass and the report says that no comparison was possible, rather than claiming there were no new issues. Merge one pull request, or push to the default branch, to record it.

Choosing a starting point

SituationSuggested gate
New project, or a site with no serious issuescritical=0,serious=0 (default)
Existing site with a backlog of issuesregression
Trying QualityGate without blocking anyoneAny gate plus continue-on-error: true
Agency tracking a client’s siteregression on pull requests, and a scheduled scan of production

Separate baselines for multiple sites

If one project scans several sites, give each site a stable key such as storefront or wholesale. Set site_key: storefront in GitHub Actions or QUALITYGATE_SITE_KEY: storefront in GitLab or Bitbucket. Use the same key in the target-branch baseline job and all its PR preview jobs, even when the preview hostname changes. Keys allow lowercase letters and digits, with hyphens between words, up to 63 characters.

Establish each named baseline with a target-branch scan before relying on regression enforcement. Named runs start with their own history and do not inherit an unnamed baseline. Workflows without a key keep their existing baseline. QualityGate compares normalized page paths within each site. If two query-string variants of the same path need separate baselines, give those variants distinct keys. Use separate CI steps for separate sites when calculating a combined decision.