Mergify Configuration Management
Overview
The mergify config command group provides tools for validating Mergify configuration files against the official schema and simulating what Mergify would do on a specific pull request using a local configuration file.
Commands
Configuration File Detection
Mergify CLI auto-detects the configuration file from standard locations:
.mergify.yml.mergify/config.yml.github/mergify.yml
Override with --config-file / -f:
Validating Configuration (validate)
Validates the Mergify configuration file against the official JSON schema fetched from https://docs.mergify.com/mergify-configuration-schema.json.
Output:
- If valid: prints a success message and exits with code 0
- If invalid: prints the number of errors and each error's path and message, then exits with code 1
Use in CI:
Simulating Actions (simulate)
Simulates what Mergify would do on a specific pull request using the local configuration file. This lets you test configuration changes before committing them.
Required arguments:
PULL_REQUEST_URL-- Full GitHub URL of the pull request to simulate against
Options:
--token/-t(env:MERGIFY_TOKEN) -- Mergify credential. Falls back to the credentialmergify auth loginstored, then toGITHUB_TOKEN/gh auth token, both deprecated for the Mergify API.--api-url/-u(env:MERGIFY_API_URL) -- Mergify API URL (default:https://api.mergify.com)
Output: Shows a title and detailed Markdown summary of what actions Mergify would take on the PR with the local configuration.
Writing and Editing Configuration
When helping a user write, edit, or understand a Mergify configuration file, always fetch the relevant documentation pages first. Do not rely on memorized knowledge -- the configuration format, available actions, and conditions syntax evolve over time.
Documentation index
Fetch https://docs.mergify.com/llms.txt to get the full documentation index
with all available pages and their descriptions.
Key reference pages
Fetch the pages relevant to the user's request before writing any configuration:
For individual actions (assign, backport, close, comment, copy, dismiss_reviews,
edit, github_actions, label, merge, queue, rebase, request_reviews, review,
squash, update), fetch the specific action page at
https://docs.mergify.com/workflow/actions/<action_name>.
Workflow
- Read the user's existing config (if any) to understand current state
- Fetch the relevant doc pages for the features the user needs
- Write or update the configuration based on the documentation
- Validate: run
mergify config validateto check for errors - Simulate (optional): run
mergify config simulate <PR_URL>against a real PR to verify the rules behave as expected


