Skip to content

Commit 31f5ada

Browse files
committed
wire in base branch read from config
1 parent e3ade2c commit 31f5ada

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

cmd/org/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func orgCreateFunc(cmd *cobra.Command, args []string) {
6161
owner = repo.GetOwner().GetLogin()
6262
appendStr = fmt.Sprintf("\nCurrent Repo: %v/%v", owner, name)
6363

64-
url, err := repositories.Process(ctx, client, repo, dryRun)
64+
url, err := repositories.Process(ctx, client, repo, base, dryRun)
6565
if err != nil {
6666
if strings.HasPrefix(err.Error(), "get branch: ") || strings.HasPrefix(err.Error(), "no commits") {
6767
bar.Incr()

cmd/org/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func orgReleaseFunc(cmd *cobra.Command, args []string) {
3636
return
3737
}
3838

39-
releases, err := repositories.GetReleases(ctx, client, repos)
39+
releases, err := repositories.GetReleases(ctx, client, repos, base)
4040
if err != nil {
4141
fmt.Printf("releases: %v\n", err.Error())
4242
os.Exit(1)

cmd/user/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func userCreateFunc(cmd *cobra.Command, args []string) {
6161
owner = repo.GetOwner().GetLogin()
6262
appendStr = fmt.Sprintf("\nCurrent Repo: %v/%v", owner, name)
6363

64-
url, err := repositories.Process(ctx, client, repo, dryRun)
64+
url, err := repositories.Process(ctx, client, repo, base, dryRun)
6565
if err != nil {
6666
if strings.HasPrefix(err.Error(), "get branch: ") || strings.HasPrefix(err.Error(), "no commits") {
6767
bar.Incr()

cmd/user/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func userReleaseFunc(cmd *cobra.Command, args []string) {
3636
return
3737
}
3838

39-
releases, err := repositories.GetReleases(ctx, client, repos)
39+
releases, err := repositories.GetReleases(ctx, client, repos, base)
4040
if err != nil {
4141
fmt.Printf("releases: %v\n", err.Error())
4242
os.Exit(1)

repositories/process.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ Release PR created with ` + "`train`"
1414

1515
// Process takes a github client, context for the client, and a repo to process.
1616
// It returns the resulting pull request URL or an error if any are encountered.
17-
func Process(ctx context.Context, client *github.Client, repo *github.Repository, dryRun bool) (string, error) {
17+
func Process(ctx context.Context, client *github.Client, repo *github.Repository, base string, dryRun bool) (string, error) {
1818
name := repo.GetName()
1919
owner := repo.GetOwner().GetLogin()
2020
head := repo.GetDefaultBranch()
21-
base := "release"
2221

2322
_, _, err := client.Repositories.GetBranch(ctx, owner, name, base)
2423
if err != nil {

repositories/releases.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
// GetReleases takes a context, github client, and respos to iterate and collects
1313
// release pull requests for the repos.
14-
func GetReleases(ctx context.Context, client *github.Client, repos []*github.Repository) ([]*github.PullRequest, error) {
14+
func GetReleases(ctx context.Context, client *github.Client, repos []*github.Repository, base string) ([]*github.PullRequest, error) {
1515
var releases []*github.PullRequest
1616

1717
count := len(repos)
@@ -34,7 +34,6 @@ func GetReleases(ctx context.Context, client *github.Client, repos []*github.Rep
3434
name = repo.GetName()
3535
appendStr = fmt.Sprintf("\nCurrent Repo: %v/%v", owner, name)
3636
head := repo.GetDefaultBranch()
37-
base := "release"
3837

3938
opts := &github.PullRequestListOptions{
4039
Head: head,

0 commit comments

Comments
 (0)