Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for overriding base branch names #64

Merged
merged 6 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add support for customizing the base branch name
Support overriding base branch name
  • Loading branch information
nirnanaaa committed Jan 3, 2022
commit 63c054dbefaf92d1a6c0f43255247c23b1f42e41
1 change: 1 addition & 0 deletions cmd/git-xargs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func parseGitXargsConfig(c *cli.Context) (*config.GitXargsConfig, error) {
config.SkipPullRequests = c.Bool("skip-pull-requests")
config.SkipArchivedRepos = c.Bool("skip-archived-repos")
config.BranchName = c.String("branch-name")
config.BaseBranchName = c.String("base-branch-name")
config.CommitMessage = c.String("commit-message")
config.PullRequestTitle = c.String("pull-request-title")
config.PullRequestDescription = c.String("pull-request-description")
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type GitXargsConfig struct {
SkipArchivedRepos bool
MaxConcurrentRepos int
BranchName string
BaseBranchName string
CommitMessage string
PullRequestTitle string
PullRequestDescription string
Expand All @@ -40,6 +41,7 @@ func NewGitXargsConfig() *GitXargsConfig {
SkipArchivedRepos: false,
MaxConcurrentRepos: 0,
BranchName: "",
BaseBranchName: "",
CommitMessage: common.DefaultCommitMessage,
PullRequestTitle: common.DefaultPullRequestTitle,
PullRequestDescription: common.DefaultPullRequestDescription,
Expand Down
5 changes: 4 additions & 1 deletion repository/repo-operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,11 @@ func openPullRequest(config *config.GitXargsConfig, repo *github.Repository, bra
}).Debug("--dry-run and / or --skip-pull-requests is set to true, so skipping opening a pull request!")
return nil
}
repoDefaultBranch := config.BaseBranchName
if repoDefaultBranch == "" {
repoDefaultBranch = repo.GetDefaultBranch()
}

repoDefaultBranch := repo.GetDefaultBranch()
pullRequestAlreadyExists, err := pullRequestAlreadyExistsForBranch(config, repo, branch, repoDefaultBranch)

if err != nil {
Expand Down