CI Insights
Send JUnit results and pull request scopes from any CI provider into Mergify.
Learn more: CI Insights
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 with the ci scope. Falls back to MERGIFY_TOKEN. Without either, a GitHub Actions job granted id-token: write exchanges its ID token for a Mergify OIDC CI token, when a trust policy of the organization allows the job; on any other CI, set one. 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
The former name of --scopes-json, which replaces it
--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, or 64 in a SHA-256 repository, 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, and on a Jenkins pull request build from the commit it checked out (GIT_COMMIT, else HEAD), or the pull request's side of the merge Jenkins made of it into its target branch. Pass the pull request's head, not the revision the job checked out, wherever it is not detected, as on Jenkins outside the checkout or on an agent that merges with JGit. Without a head SHA the command fails
--skip-when-mergify-unavailable flag Warn and exit 0 instead of failing when Mergify answers the upload with a server error, a timeout or a throttle once the retries run out, or does not answer. Any other refusal still fails. For a required check that must stay green while Mergify is down: the merge queue waits for these scopes until the job runs again
-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
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.
MERGIFY_TOKEN The Mergify credential: an application key in CI. A GitHub Actions job granted id-token: write needs none: without it, the test reporters and the mergify commands that call Mergify's API exchange the job's ID token for a Mergify token holding what the trust policies of the organization that allow the job grant, a command outside mergify ci only when mergify auth login stored no credential either. Without either, 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 merge queue batch, the base is the commit of the base branch below every batch the queue branch is built on, so a diff from it holds every pull request the batch's pass merges. With --for-scopes, it is the top of those batches instead, so a diff from it holds the batch's own pull requests: what its scopes are detected from.
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
--for-scopes flag Give the base the build's scopes are detected from rather than the one its other diffs compare from. They differ only on a merge queue batch built on other batches
-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
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 GitHub pull request event or 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
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
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 Mergify application key with the ci scope. Falls back to MERGIFY_TOKEN. Without either, a GitHub Actions job granted id-token: write exchanges its ID token for a Mergify OIDC CI token, when a trust policy of the organization allows the job; on any other CI, set one. The credential mergify auth login stores is not used here
-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
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.
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. A GitHub Actions job granted id-token: write needs none: without it, the test reporters and the mergify commands that call Mergify's API exchange the job's ID token for a Mergify token holding what the trust policies of the organization that allow the job grant, a command outside mergify ci only when mergify auth login stored no credential either. Without either, 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, as junit-process does. The former name of junit-process, which replaces it: it runs the same processing and prints a warning.
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 Mergify application key with the ci scope. Falls back to MERGIFY_TOKEN. Without either, a GitHub Actions job granted id-token: write exchanges its ID token for a Mergify OIDC CI token, when a trust policy of the organization allows the job; on any other CI, set one. The credential mergify auth login stores is not used here
-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
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.
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. A GitHub Actions job granted id-token: write needs none: without it, the test reporters and the mergify commands that call Mergify's API exchange the job's ID token for a Mergify token holding what the trust policies of the organization that allow the job grant, a command outside mergify ci only when mergify auth login stored no credential either. Without either, 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?
Thanks for your feedback!