Skip to content

Commit

Permalink
Update branch name creation
Browse files Browse the repository at this point in the history
  • Loading branch information
janekbaraniewski committed Jul 18, 2023
1 parent 4bdb815 commit 16348ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package issuectl
import (
"fmt"
"os"
"strings"
)

const (
Expand Down Expand Up @@ -48,20 +49,22 @@ func StartWorkingOnIssue(issueID IssueID) error {
return err
}

Log.V(2).Infof("Creating branch")
if err := createBranch(repoDirPath, string(issueID)); err != nil {
return err
}

issue, err := ghClient.GetIssue(repo.Owner, string(repo.Name), issueID)
if err != nil {
return fmt.Errorf("failed to get the issue: %v", err)
}

Log.V(2).Infof("Creating branch")
branchName := fmt.Sprintf("%v-%v", issueID, strings.ReplaceAll(*issue.Title, " ", "-"))
if err := createBranch(repoDirPath, branchName); err != nil {
return err
}

if err := config.AddIssue(&IssueConfig{
Name: *issue.Title,
ID: issueID,
RepoName: profile.Repository,
BranchName: branchName,
BackendName: "github",
Dir: issueDirPath,
Profile: profile.Name,
Expand Down
1 change: 1 addition & 0 deletions pkg/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type IssueConfig struct {
Name string `json:"name"`
ID IssueID `json:"id"`
BackendName BackendConfigName `json:"backendName"`
BranchName string `json:"branchName"`
RepoName RepoConfigName `json:"repoName"`
Dir string `json:"dir"`
Profile ProfileName `json:"profile"`
Expand Down

0 comments on commit 16348ce

Please sign in to comment.