mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-07-01 23:23:46 +00:00
feat(issue-77): handle multiple target branches (#78)
fix: https://github.com/kiegroup/git-backporting/issues/77 This enhancement allow users to backport the same change to multiple branches with one single tool invocation
This commit is contained in:
parent
c19a56a9ad
commit
5fc72e127b
25 changed files with 1774 additions and 234 deletions
|
@ -17,8 +17,8 @@ export default abstract class ArgsParser {
|
|||
const args = this.readArgs();
|
||||
|
||||
// validate and fill with defaults
|
||||
if (!args.pullRequest || !args.targetBranch) {
|
||||
throw new Error("Missing option: pull request and target branch must be provided");
|
||||
if (!args.pullRequest || !args.targetBranch || args.targetBranch.trim().length == 0) {
|
||||
throw new Error("Missing option: pull request and target branches must be provided");
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/**
|
||||
* Input arguments
|
||||
* Tool's input arguments interface
|
||||
*/
|
||||
export interface Args {
|
||||
targetBranch: string, // branch on the target repo where the change should be backported to
|
||||
// NOTE: keep targetBranch as singular and of type string for backward compatibilities
|
||||
targetBranch: string, // comma separated list of branches on the target repo where the change should be backported to
|
||||
pullRequest: string, // url of the pull request to backport
|
||||
dryRun?: boolean, // if enabled do not push anything remotely
|
||||
auth?: string, // git service auth, like github token
|
||||
|
@ -12,7 +13,8 @@ export interface Args {
|
|||
title?: string, // backport pr title, default original pr title prefixed by target branch
|
||||
body?: string, // backport pr title, default original pr body prefixed by bodyPrefix
|
||||
bodyPrefix?: string, // backport pr body prefix, default `backport <original-pr-link>`
|
||||
bpBranchName?: string, // backport pr branch name, default computed from commit
|
||||
// NOTE: keep bpBranchName as singular and of type string for backward compatibilities
|
||||
bpBranchName?: string, // comma separated list of backport pr branch names, default computed from commit and target branches
|
||||
reviewers?: string[], // backport pr reviewers
|
||||
assignees?: string[], // backport pr assignees
|
||||
inheritReviewers?: boolean, // if true and reviewers == [] then inherit reviewers from original pr
|
||||
|
|
|
@ -10,7 +10,7 @@ export default class CLIArgsParser extends ArgsParser {
|
|||
return new Command(name)
|
||||
.version(version)
|
||||
.description(description)
|
||||
.option("-tb, --target-branch <branch>", "branch where changes must be backported to")
|
||||
.option("-tb, --target-branch <branches>", "comma separated list of branches where changes must be backported to")
|
||||
.option("-pr, --pull-request <pr-url>", "pull request url, e.g., https://github.com/kiegroup/git-backporting/pull/1")
|
||||
.option("-d, --dry-run", "if enabled the tool does not create any pull request nor push anything remotely")
|
||||
.option("-a, --auth <auth>", "git service authentication string, e.g., github token")
|
||||
|
@ -20,7 +20,7 @@ export default class CLIArgsParser extends ArgsParser {
|
|||
.option("--title <bp-title>", "backport pr title, default original pr title prefixed by target branch")
|
||||
.option("--body <bp-body>", "backport pr title, default original pr body prefixed by bodyPrefix")
|
||||
.option("--body-prefix <bp-body-prefix>", "backport pr body prefix, default `backport <original-pr-link>`")
|
||||
.option("--bp-branch-name <bp-branch-name>", "backport pr branch name, default auto-generated by the commit")
|
||||
.option("--bp-branch-name <bp-branch-names>", "comma separated list of backport pr branch names, default auto-generated by the commit and target branch")
|
||||
.option("--reviewers <reviewers>", "comma separated list of reviewers for the backporting pull request", getAsCleanedCommaSeparatedList)
|
||||
.option("--assignees <assignees>", "comma separated list of assignees for the backporting pull request", getAsCleanedCommaSeparatedList)
|
||||
.option("--no-inherit-reviewers", "if provided and reviewers option is empty then inherit them from original pull request")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue