Skip to content

Commit 094ca7a

Browse files
committed
make combineBranchName and workingBranchSuffix cli args with defaults
1 parent b6bba2e commit 094ca7a

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

internal/cmd/combine_prs.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ func CombinePRs(ctx context.Context, graphQlClient *api.GraphQLClient, restClien
1818
BaseSHA string
1919
}) error {
2020
// Define the combined branch name
21-
combineBranchName := "combined-prs"
22-
workingBranchName := combineBranchName + "-working"
21+
workingBranchName := combineBranchName + workingBranchSuffix
2322

2423
baseBranchSHA, err := getBranchSHA(ctx, restClient, owner, repo, baseBranch)
2524
if err != nil {

internal/cmd/root.go

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,25 @@ import (
1414
)
1515

1616
var (
17-
branchPrefix string
18-
branchSuffix string
19-
branchRegex string
20-
selectLabel string
21-
selectLabels []string
22-
addLabels []string
23-
addAssignees []string
24-
requireCI bool
25-
mustBeApproved bool
26-
autoclose bool
27-
updateBranch bool
28-
ignoreLabel string
29-
ignoreLabels []string
30-
reposFile string
31-
minimum int
32-
defaultOwner string
33-
baseBranch string
17+
branchPrefix string
18+
branchSuffix string
19+
branchRegex string
20+
selectLabel string
21+
selectLabels []string
22+
addLabels []string
23+
addAssignees []string
24+
requireCI bool
25+
mustBeApproved bool
26+
autoclose bool
27+
updateBranch bool
28+
ignoreLabel string
29+
ignoreLabels []string
30+
reposFile string
31+
minimum int
32+
defaultOwner string
33+
baseBranch string
34+
combineBranchName string
35+
workingBranchSuffix string
3436
)
3537

3638
// NewRootCmd creates the root command for the gh-combine CLI
@@ -81,9 +83,11 @@ func NewRootCmd() *cobra.Command {
8183
gh combine octocat/hello-world --add-assignees octocat,hubot # Assign users to the new PR
8284
8385
# Additional options
84-
gh combine octocat/hello-world --autoclose # Close source PRs when combined PR is merged
85-
gh combine octocat/hello-world --base-branch main # Use a different base branch for the combined PR
86-
gh combine octocat/hello-world --update-branch # Update the branch of the combined PR`,
86+
gh combine octocat/hello-world --autoclose # Close source PRs when combined PR is merged
87+
gh combine octocat/hello-world --base-branch main # Use a different base branch for the combined PR
88+
gh combine octocat/hello-world --combine-branch-name combined-prs # Use a different name for the combined PR branch
89+
gh combine octocat/hello-world --working-branch-suffix -working # Use a different suffix for the working branch
90+
gh combine octocat/hello-world --update-branch # Update the branch of the combined PR`,
8791
RunE: runCombine,
8892
}
8993

@@ -110,6 +114,8 @@ func NewRootCmd() *cobra.Command {
110114
rootCmd.Flags().BoolVar(&autoclose, "autoclose", false, "Close source PRs when combined PR is merged")
111115
rootCmd.Flags().BoolVar(&updateBranch, "update-branch", false, "Update the branch of the combined PR if possible")
112116
rootCmd.Flags().StringVar(&baseBranch, "base-branch", "main", "Base branch for the combined PR (default: main)")
117+
rootCmd.Flags().StringVar(&combineBranchName, "combine-branch-name", "combined-prs", "Name of the combined PR branch")
118+
rootCmd.Flags().StringVar(&workingBranchSuffix, "working-branch-suffix", "-working", "Suffix of the working branch")
113119
rootCmd.Flags().StringVar(&reposFile, "file", "", "File containing repository names, one per line")
114120
rootCmd.Flags().IntVar(&minimum, "minimum", 2, "Minimum number of PRs to combine")
115121
rootCmd.Flags().StringVar(&defaultOwner, "owner", "", "Default owner for repositories (if not specified in repo name or missing from file inputs)")

0 commit comments

Comments
 (0)