CI Insights

Send JUnit results and pull request scopes from any CI provider into Mergify.


mergify ci scopes-send #

Send scopes tied to a pull request to Mergify. Upload the scopes affected by a pull request so Test Engine can attribute test results to them. Reads scopes from repeated --scope flags or from a file produced by "mergify ci scopes --write". Exits 0 without doing anything when no pull request can be determined.

mergify ci scopes-send [OPTIONS]
-r, --repository <REPOSITORY> string

Repository full name (owner/repo). Detected from the CI environment or the local git remote when omitted

-p, --pull-request <PULL_REQUEST> string

Pull request number. When omitted, it's detected from the CI environment: under GitHub Actions from the event payload (.pull_request.number in GITHUB_EVENT_PATH), under Buildkite from BUILDKITE_PULL_REQUEST, under Jenkins from CHANGE_ID. When none can be detected the command prints a skip message and exits 0

-t, --token <TOKEN> string

Mergify application key. Falls back to MERGIFY_TOKEN. The CI endpoints require an application key, so the credential mergify auth login stores is not used here

-u, --api-url <API_URL> string

Mergify API URL. Falls back to MERGIFY_API_URL env var, then to the default

-s, --scope <SCOPE> string

Scope to upload (repeatable)

--scopes-json <SCOPES_JSON> path

JSON file containing scopes to upload (output of mergify ci scopes --write)

--scopes-file <SCOPES_FILE> path

Plain-text file with one scope per line

--all flag

Declare that the pull request impacts every scope. The merge queue then treats it as a barrier: it is never batched or run in parallel with other pull requests. The concrete scopes are still sent alongside the flag

--head-sha <HEAD_SHA> string

Head SHA the scopes were computed for, as 40 hexadecimal characters, so a result computed for an older head is not taken for the current one. When omitted it is detected from the CI environment: under GitHub Actions from the event payload (.pull_request.head.sha in GITHUB_EVENT_PATH), under Buildkite from BUILDKITE_COMMIT, under CircleCI from CIRCLE_SHA1. Pass the pull request's head, not the revision the job checked out: on a GitHub pull_request event those differ, and so does Jenkins' GIT_COMMIT when the GitHub Branch Source plugin merges the pull request into its target branch, as older sources do ("The current pull request revision" strategy makes GIT_COMMIT the head). Without a head SHA the scopes are reported by pull request number, which is deprecated

-v, --verbose flag

Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this

--debug flag

Shorthand for at least debug-level logging (like -vv)

--color <COLOR> auto | always | never

When to use color in terminal output

Values: auto always never

Default: auto

MERGIFY_API_URL

Base URL of the Mergify API. An API URL given on the command line or in a reporter's configuration takes precedence.

Default: https://api.mergify.com

MERGIFY_TOKEN

The Mergify credential: an application key in CI. Without it the test reporters upload nothing. A mergify command takes it when --token is not given, over the credential mergify auth login stored, and mergify auth tells when it does. The mergify stack commands send it to GitHub as their GitHub token, ahead of GITHUB_TOKEN, unless it holds a Mergify user token (mut_…).

mergify ci git-refs #

Print the base/head git references for the current build. Detect and print the base and head git references for the build from the CI environment, as plain text, eval-friendly shell lines, or JSON. Useful for wiring later steps to the same refs Mergify computed. On a GitHub push that did not fast-forward, such as a push back to an earlier commit, the head is a commit made in the local clone: the pushed commit's files, with the base, the commit the push replaced, as its only parent. A tool that compares from the merge base, as nx affected --base --head does, then sees every file the push changed. The base is fetched by its SHA when the clone lacks it, and when it cannot be, or out of a clone, the pushed commit is printed with a warning. No other clone has that head: run the command in the one that compares, where it makes the same commit. On a Jenkins build of a merge queue batch, as its draft pull request or as a branch, the base is the commit the batch was built on, read from the merge queue's git note on origin, which needs the repository's credentials in the step, and fetched when the clone lacks it. On any other Jenkins change request build, the base is the commit of the branch the pull request targets (CHANGE_TARGET) on origin, fetched with the history it shares with HEAD when the clone lacks it, and the head is HEAD.

mergify ci git-refs [OPTIONS]
--format <FORMAT> string

Output format: text (default), shell for eval-friendly MERGIFY_GIT_REFS_* lines, or json for a single JSON object

Default: text

-v, --verbose flag

Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this

--debug flag

Shorthand for at least debug-level logging (like -vv)

--color <COLOR> auto | always | never

When to use color in terminal output

Values: auto always never

Default: auto

mergify ci queue-info #

Print the current build's merge queue batch metadata (from the Mergify git note). Read the Mergify git note attached to the current HEAD (on a Jenkins change request, to the draft's head) and print the merge queue batch the build belongs to. Needs only plain git and no token, so it works in any CI runner.

mergify ci queue-info [OPTIONS]
-v, --verbose flag

Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this

--debug flag

Shorthand for at least debug-level logging (like -vv)

--color <COLOR> auto | always | never

When to use color in terminal output

Values: auto always never

Default: auto

mergify ci scopes #

Give the list of scopes impacted by changed files. Compute the configured scopes impacted by the files changed between two git references, using your Mergify configuration. On a merge queue batch build, return instead the scopes the merge queue decided for the batch, read from its git note, plus the merge queue scope. Print them, or write them to a file with --write for a later "mergify ci scopes-send".

mergify ci scopes [OPTIONS]
--config <CONFIG> path

Path to YAML config file (auto-detected when omitted)

--base <BASE> string

Base git reference to use to look for changed files

--head <HEAD> string

Head git reference to use to look for changed files

-w, --write <WRITE> path

Write the detected scopes to a file (JSON, consumed by ci scopes-send --scopes-json)

-v, --verbose flag

Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this

--debug flag

Shorthand for at least debug-level logging (like -vv)

--color <COLOR> auto | always | never

When to use color in terminal output

Values: auto always never

Default: auto

MERGIFY_CONFIG_PATH

Path of the Mergify configuration file mergify ci scopes reads its scopes from, when --config is not given. Unset or empty, the command looks for the file where mergify config validate does.

mergify ci junit-process #

Upload JUnit XML reports and ignore failed tests with Mergify Test Engine's quarantine. Parse one or more JUnit XML reports, upload the results to Test Engine, and reconcile them against the quarantine so known-flaky tests don't fail the build. Accepts file paths or glob patterns; pass the runner's exit code with --test-exit-code to detect silent failures.

mergify ci junit-process [OPTIONS] <FILE>...
<FILE>... string required repeatable

JUnit XML files or glob patterns (e.g. reports/**/*.xml). At least one path or pattern is required

-u, --api-url <API_URL> string

Mergify API URL. Falls back to MERGIFY_API_URL env var, then to the default (https://api.mergify.com)

-t, --token <TOKEN> string

CI Issues application key. Falls back to MERGIFY_TOKEN

-r, --repository <REPOSITORY> string

Repository full name (owner/repo). Detected from the CI environment or the local git remote when omitted

--test-framework <TEST_FRAMEWORK> string

Test framework label (e.g. pytest). Optional; passed as a span attribute

--test-language <TEST_LANGUAGE> string

Test language label (e.g. python). Optional; passed as a span attribute

-b, --tests-target-branch <TESTS_TARGET_BRANCH> string

Branch the quarantine API should look up tests on. Defaults to the PR base branch, or the head branch as a fallback; without one, quarantine is off for the run and every failure blocks

-e, --test-exit-code <TEST_EXIT_CODE> string

Exit code of the test runner. When this is non-zero but no failures appear in the JUnit report, the run is flagged as a silent failure. Falls back to MERGIFY_TEST_EXIT_CODE

-v, --verbose flag

Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this

--debug flag

Shorthand for at least debug-level logging (like -vv)

--color <COLOR> auto | always | never

When to use color in terminal output

Values: auto always never

Default: auto

MERGIFY_API_URL

Base URL of the Mergify API. An API URL given on the command line or in a reporter's configuration takes precedence.

Default: https://api.mergify.com

MERGIFY_TEST_EXIT_CODE

Exit code of the test runner, when --test-exit-code is not given. When it is not zero and the JUnit report holds no failure, the run is flagged as a silent failure.

MERGIFY_TEST_JOB_NAME

Name the job's test results are reported under, instead of the CI job's own name. Set one per environment, never per shard: a name per shard splits a test's history.

MERGIFY_TOKEN

The Mergify credential: an application key in CI. Without it the test reporters upload nothing. A mergify command takes it when --token is not given, over the credential mergify auth login stored, and mergify auth tells when it does. The mergify stack commands send it to GitHub as their GitHub token, ahead of GITHUB_TOKEN, unless it holds a Mergify user token (mut_…).

MERGIFY_TRACEPARENT

W3C traceparent of a trace the job already started: the test session's spans join that trace instead of starting their own. A malformed value is ignored.

mergify ci junit-upload deprecated #

Upload JUnit XML reports (deprecated: use junit-process). Deprecated alias for junit-process, kept for backward compatibility. It runs the same processing and prints a deprecation warning; use junit-process instead.

mergify ci junit-upload [OPTIONS] <FILE>...
<FILE>... string required repeatable

JUnit XML files or glob patterns (e.g. reports/**/*.xml). At least one path or pattern is required

-u, --api-url <API_URL> string

Mergify API URL. Falls back to MERGIFY_API_URL env var, then to the default (https://api.mergify.com)

-t, --token <TOKEN> string

CI Issues application key. Falls back to MERGIFY_TOKEN

-r, --repository <REPOSITORY> string

Repository full name (owner/repo). Detected from the CI environment or the local git remote when omitted

--test-framework <TEST_FRAMEWORK> string

Test framework label (e.g. pytest). Optional; passed as a span attribute

--test-language <TEST_LANGUAGE> string

Test language label (e.g. python). Optional; passed as a span attribute

-b, --tests-target-branch <TESTS_TARGET_BRANCH> string

Branch the quarantine API should look up tests on. Defaults to the PR base branch, or the head branch as a fallback; without one, quarantine is off for the run and every failure blocks

-e, --test-exit-code <TEST_EXIT_CODE> string

Exit code of the test runner. When this is non-zero but no failures appear in the JUnit report, the run is flagged as a silent failure. Falls back to MERGIFY_TEST_EXIT_CODE

-v, --verbose flag

Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this

--debug flag

Shorthand for at least debug-level logging (like -vv)

--color <COLOR> auto | always | never

When to use color in terminal output

Values: auto always never

Default: auto

MERGIFY_API_URL

Base URL of the Mergify API. An API URL given on the command line or in a reporter's configuration takes precedence.

Default: https://api.mergify.com

MERGIFY_TEST_EXIT_CODE

Exit code of the test runner, when --test-exit-code is not given. When it is not zero and the JUnit report holds no failure, the run is flagged as a silent failure.

MERGIFY_TEST_JOB_NAME

Name the job's test results are reported under, instead of the CI job's own name. Set one per environment, never per shard: a name per shard splits a test's history.

MERGIFY_TOKEN

The Mergify credential: an application key in CI. Without it the test reporters upload nothing. A mergify command takes it when --token is not given, over the credential mergify auth login stored, and mergify auth tells when it does. The mergify stack commands send it to GitHub as their GitHub token, ahead of GITHUB_TOKEN, unless it holds a Mergify user token (mut_…).

MERGIFY_TRACEPARENT

W3C traceparent of a trace the job already started: the test session's spans join that trace instead of starting their own. A malformed value is ignored.

Was this page helpful?