tibdex / github-backport Goto Github PK
View Code? Open in Web Editor NEW๐ Backport a pull request using the GitHub REST API
License: MIT License
๐ Backport a pull request using the GitHub REST API
License: MIT License
when a PR is tagged to be backported to multiple branches if one of the backports fails the others are not executed and there is no message by backport bot.
examples can be found here
removing and readding the labels will trigger further backports. also, it seems that the order with which the labels are set to the PR might be relevant. here an example where one bp failed and one succeeded.
We've started using the app for the Zephyr Project:
zephyrproject-rtos/zephyr#15515
But unfortunately our CI seems to stumble onto an unknown Git ref that we have no idea where is coming from:
https://app.shippable.com/github/zephyrproject-rtos/zephyr/runs/39643/1/console
git checkout -f cherry-pick-backport-15261-to-v1.14-branch-4c757f0a-e2e6-4102-b293-b0a458199a1c --
fatal: invalid reference: cherry-pick-backport-15261-to-v1.14-branch-4c757f0a-e2e6-4102-b293-b0a458199a1c
Any ideas as to where this unknown ref is being fed to Shippable?
If a backport pull request already exists github-backport
throws an error with this message: "Reference already exists"
More details:
{
"name": "HttpError",
"status": 422,
"headers": { ... },
"request": {
"method": "POST",
"url": "https://api.github.com/repos/sqren/backport-demo/git/refs",
"headers": {
"accept": "application/vnd.github.v3+json",
"user-agent": "octokit-rest.js/18.0.3 octokit-core.js/3.1.1 Node.js/10.21.0 (darwin; x64)",
"authorization": "token [REDACTED]",
"content-type": "application/json; charset=utf-8"
},
"body": "{\"ref\":\"refs/heads/backport-to-6.3\",\"sha\":\"e812829351c83be297d48ad7f4788ccf73c4de26\"}",
"request": {}
},
"documentation_url": "https://docs.github.com/rest/reference/git#create-a-reference"
}
My suggestion is to handle this by updating the existing PR by updating the reference with the latest sha from the base branch. This will make it possible to rebase an existing backport pull request.
This could perhaps be handled explicitly with a new option like allowRebase
:
backportPullRequest({
allowRebase: true
})
or force
:
backportPullRequest({
force: true
})
I'm getting the following error when running tsc
node_modules/github-backport/lib/index.d.ts:9:14 - error TS2709: Cannot use namespace 'Octokit' as a type.
9 octokit: Octokit;
~~~~~~~
Found 1 error.
Sometimes the user performing the backport does not have push access to the primary repository, and the backport branch should therefore be created in a fork.
The Github docs specifies how to create a cross-repo PR:
The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.
I therefore tried to specify the head
as:
backportPullRequest({
head: `some-username:some-branch`,
});
But this throws an error:
refs/heads/some-username:some-branch is not a valid ref name.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.