Copy

Copy a pull request to another branch.


The copy action enables you to automatically create a copy of a pull request. When the conditions you specify are met, Mergify will create a new pull request to merge the changes into the specified base branch.

Note that in case of a conflict during the copy, Mergify will create a pull request with the conflict; you will have to resolve it manually. You can change this behaviour using the ignore_conflicts option.

The copy action takes a list of branches to which the changes from the pull request will be copied. The branch names should be specified as strings.

Key nameValue typeDefault
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.

body

template

"{{ body }}
This is an automatic copy of pull request #{{number}} done by [Mergify](https://mergify.com)."

The pull request body.

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.

branches

list of branch names

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

ignore_conflictsbooleantrue

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

labels

list of string

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

label_conflictsstringconflicts

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

regexes

list of string

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

title

template

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

The pull request title.

report_mode

list of report modes

- check

List of reporting modes for the action's result.

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 the destination branch.

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

Below is an example of how to use the copy action:

pull_request_rules:
- name: copy patches to the prod branch
conditions:
- label=copy-to-prod
actions:
copy:
branches:
- prod