This Github Action will automatically create backport pull request when a pull request is merged, based on the labels it contains.
Example
By merging a pull request with the labels backport-to-staging
and backport-to-production
Backport Github Action (BGA) will automatically create backport pull requests to the branches "staging" and "production".
How to use
Add the backport workflow to .github/workflows/backport.yml
:
name: Backport
on:
pull_request_target:
types:
- closed
- labeled
jobs:
backport:
name: Backport Action
runs-on: ubuntu-latest
steps:
- name: Backport
uses: sqren/backport-github-action@v1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
backport_by_label: '^backport-to-(.*)$'
Backport CLI (optional)
Backport CLI is a tool that makes it much easier to create ad-hoc backport pull requests. This integrates seemlessly with the Backport Github Action. All you need to do is to add a backport configuration file to the repository root:
// .backportrc.json
{
"upstream": "<repo name>/<repo owner>",
"targetBranchChoices": ["master", "staging", "production", "<any other branch>"]
}