copy๐Ÿ”—

Warning

If the repository is bigger than 512 MB, the copy action is only available for Essential and Premium Plan subscribers.

The copy action creates a copy of the pull request targeting other branches.

Options๐Ÿ”—

Key Name

Value Type

Default

Value Description

branches

list of string

[]

The list of branches the pull request should be copied to.

regexes

list of string

[]

The list of regexes to find branches the pull request should be copied to.

ignore_conflicts

Boolean

true

Whether to create the pull requests even if they are conflicts when cherry-picking the commits.

bot_account

Template

Mergify can impersonate a GitHub user to copy a pull request. If no bot_account is set, Mergify copies the pull request itself.

labels

list of string

[]

The list of labels to add to the created pull requests.

label_conflicts

string

conflicts

The label to add to the created pull request if it has conflicts and ignore_conflicts is set to true.

assignees

list of Template

Users to assign the newly created pull request. As the type is Template, you could use, e.g., {{author}} to assign the pull request to its original author.

title

Template

{{ title }} (copy #{{ number }})

The pull request title.

body

Template

This is an automatic copy of pull request #{{number}} done by [Mergify](https://mergify.io).\n{{cherry_pick_error}}

The pull request body.

As the title and body are templates, you can leverage any pull request attributes to use as content, e.g. {{author}}. You can also use this additional variable:

  • {{ destination_branch }}: the name of destination branch.

  • {{ cherry_pick_error }}: the cherry pick error message if any (only available in body).

Examples๐Ÿ”—

๐Ÿ” Copy a Pull Request to Another Branch๐Ÿ”—

The following rule copies a pull request from the staging branch to the prod branch as soon as the CI passes and a label ready for prod is set on the pull request:

pull_request_rules:
  - name: copy pull request when CI passes
    conditions:
      - base=staging
      - check-success=test
      - label=ready for prod
    actions:
      copy:
        branches:
          - prod