backport ๐
It is common for software to have (some of) their major versions maintained over an extended period. Developers usually create stable branches that are maintained for a while by cherry-picking patches from the development branch.
This process is called backporting as it implies that bug fixes merged into the development branch are ported back to the stable branch(es). The stable branch can then be used to release a new minor version of the software, fixing some of its bugs.
Important
If the repository is bigger than 512 MB, thebackport
action is only
available for Essential and Premium subscribers.
As this process of backporting patches can be tedious, Mergify automates this mechanism to save developers' time and ease their duty.
The backport
action copies the pull request into another branch once the
pull request has been merged.
Once the backporting pull request is closed or merged, Mergify will automatically delete the backport head branch that it created.
You can also trigger backports using the backport command.
Options ๐
Key Name |
Value Type |
Default |
Value Description |
---|---|---|---|
|
list of string |
|
The list of branches the pull request should be copied to. |
|
list of string |
|
The list of regexes to find branches the pull request should be copied to. |
|
Boolean |
|
Whether to create the pull requests even if they are conflicts when cherry-picking the commits. |
|
list of string |
|
The list of labels to add to the created pull requests. |
|
string |
|
The label to add to the created pull request if it has conflicts and
|
|
list of Template |
Users to assign the newly created pull request. As the type is
Template, you could use, e.g., |
|
|
|
The pull request title. |
As the title
is a template, 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.
Examples ๐
๐ฉโ๐ง Using Labels to Backport Pull-Requests ๐
Copying pull requests to a maintenance branch is a common workflow. In order to elect a pull request to be backported, it's possible to use a label. With a rule such as the one below, you can trigger a backport as soon as the label is added and the pull request merged:
pull_request_rules:
- name: backport patches to stable branch
conditions:
- base=master
- label=backport-to-stable
actions:
backport:
branches:
- stable
assignees:
- "{{ author }}"