Mergify Config

作者 mergifyioe7c1ebbc2813無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Use Mergify config commands to validate configuration files, simulate Mergify actions, and write Mergify configuration. ALWAYS use this skill when validating, writing, editing, or simulating Mergify config. Triggers on config validate, config simulate, mergify configuration, mergify.yml, .mergify.yml, merge queue config, workflow rules, conditions.

僅含說明DevOps & Cloud
AI 產生的概覽

使用 mergify CLI 驗證、模擬與撰寫 Mergify 設定檔。

功能
此技能引導代理處理 Mergify 設定檔:依官方 JSON schema 進行驗證、模擬 Mergify 在指定提取要求上的行為,以及撰寫或編輯規則。它依賴 mergify config validate 與 mergify config simulate 指令,並在撰寫設定前抓取 Mergify 文件頁面。產出包括驗證成功訊息或附結束碼的錯誤清單,以及模擬動作的 Markdown 摘要。
適用情境
當使用者需要驗證、撰寫、編輯或模擬 Mergify 設定(例如 .mergify.yml、合併佇列規則、工作流程規則或條件)時使用。也適合在 CI 中加入 Mergify 設定驗證步驟。
執行需求
需要 mergify CLI(mergify-cli,可透過 pip 安裝)以及網路存取以取得 Mergify JSON schema 與文件頁面。模擬需要 Mergify 憑證(--token 或 MERGIFY_TOKEN,或已儲存的登入)以及完整的 GitHub 提取要求 URL。不附帶指令碼,僅為說明文件。

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

bash
mergify config validate                              # Validate the configuration filemergify config simulate PULL_REQUEST_URL             # Simulate actions on a PR

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:

bash
mergify config -f path/to/config.yml validate

Validating Configuration (validate)

Validates the Mergify configuration file against the official JSON schema fetched from https://docs.mergify.com/mergify-configuration-schema.json.

bash
# Validate auto-detected config filemergify config validate
# Validate a specific filemergify config -f .mergify.yml validate

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:

yaml
- name: Validate Mergify config  run: mergify config validate

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.

bash
mergify config simulate https://github.com/owner/repo/pull/123

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 credential mergify auth login stored, then to GITHUB_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:

TopicURL
File format and structurehttps://docs.mergify.com/configuration/file-format
Conditions syntax and attributeshttps://docs.mergify.com/configuration/conditions
Data types (duration, templates)https://docs.mergify.com/configuration/data-types
Configuration sharing and reusehttps://docs.mergify.com/configuration/sharing
Workflow automation overviewhttps://docs.mergify.com/workflow
All available actionshttps://docs.mergify.com/workflow/actions
Writing your first rulehttps://docs.mergify.com/workflow/writing-your-first-rule
Merge queue ruleshttps://docs.mergify.com/merge-queue/rules
Merge queue setuphttps://docs.mergify.com/merge-queue/setup
Queue priority ruleshttps://docs.mergify.com/merge-queue/priority
Merge protectionshttps://docs.mergify.com/merge-protections/setup
Custom protection ruleshttps://docs.mergify.com/merge-protections/custom-rules
Merge protection exampleshttps://docs.mergify.com/merge-protections/examples
Commands and restrictionshttps://docs.mergify.com/commands
JSON Schemahttps://docs.mergify.com/mergify-configuration-schema.json

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

  1. Read the user's existing config (if any) to understand current state
  2. Fetch the relevant doc pages for the features the user needs
  3. Write or update the configuration based on the documentation
  4. Validate: run mergify config validate to check for errors
  5. Simulate (optional): run mergify config simulate <PR_URL> against a real PR to verify the rules behave as expected

Common Patterns

Test config changes before pushing

bash
# Edit your .mergify.yml locally, then:mergify config validatemergify config simulate https://github.com/myorg/myrepo/pull/42# If both look good, commit and push

CI validation gate

yaml
jobs:  validate-mergify:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - name: Install mergify-cli        run: pip install mergify-cli      - name: Validate Mergify config        run: mergify config validate

來源與署名

來源:mergifyio/mergify-cli位於skills/mergify-config提交e7c1ebb

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架