https://github.com/cupy/backport
Create backport PR automatically (tool for CuPy maintainers)
https://github.com/cupy/backport
Last synced: 3 months ago
JSON representation
Create backport PR automatically (tool for CuPy maintainers)
- Host: GitHub
- URL: https://github.com/cupy/backport
- Owner: cupy
- License: mit
- Created: 2018-02-05T10:52:43.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-06-25T13:02:33.000Z (12 months ago)
- Last Synced: 2025-09-20T01:01:25.639Z (9 months ago)
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 9
- Watchers: 16
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `backport` - Tool to semi-automate backport pull requests
This tool is used to backport pull requests labeled `to-be-backported`.
Generally backport PRs are [automatically created by GitHub Actions workflow](https://github.com/cupy/cupy/blob/main/.github/workflows/backport.yml).
However, in case there is a conflict during the backport process, you need to run this tool in your local environment to manually resolve the conflict.
## Prerequisites
1. Create a [classic GitHub token with `public_repo` scope](https://github.com/settings/tokens/new?scopes=public_repo).
2. Install PyGitHub (`pip install pygithub`).
## Usage
For example, to backport PR #9876:
```shell
$ export BACKPORT_GITHUB_TOKEN=ghp_XXXXXXXXXXXXXXXXXXXXX
$ python backport.py --repo cupy --pr 9876
```
If there are conflicts during backport, the tool will stop and ask you to resolve the conflict manually.
Follow the instructions shown.
Run `python backport.py --help` for additional options.
## How it works
Basically it follows this procedure:
1. Clone the target branch (e.g. `v13`) of the target repository (e.g. `cupy/cupy`) to a temporary directory.
2. Create a local temporary branch and cherry-pick the merge commit of the original PR.
3. Push it to the user repository.
4. Make a backport PR.