This commit is contained in:
Moby von Briesen 2023-09-04 16:43:30 -04:00
parent bb2af2fce9
commit 47b1a335ad

View File

@ -59,7 +59,6 @@ func NewPullPal(ctx context.Context, log *zap.Logger, cfg Config) (*PullPal, err
ppRepos := []pullPalRepo{}
for _, r := range cfg.Repos {
fmt.Println(r)
parts := strings.Split(r, "/")
if len(parts) < 3 {
continue
@ -67,9 +66,6 @@ func NewPullPal(ctx context.Context, log *zap.Logger, cfg Config) (*PullPal, err
host := parts[0]
owner := parts[1]
name := parts[2]
fmt.Println(host)
fmt.Println(owner)
fmt.Println(name)
newRepo := vc.Repository{
LocalPath: filepath.Join(cfg.LocalRepoPath, owner, name),
HostDomain: host,
@ -146,7 +142,6 @@ func (p pullPalRepo) checkIssuesAndComments() error {
issue := issues[0]
err = p.handleIssue(issue)
if err != nil {
// TODO leave comment if error (make configurable)
p.log.Error("error handling issue", zap.Error(err))
commentText := fmt.Sprintf("I ran into a problem working on this:\n```\n%s\n```", err.Error())
err = p.ghClient.CommentOnIssue(issue.Number, commentText)
@ -174,7 +169,6 @@ func (p pullPalRepo) checkIssuesAndComments() error {
comment := comments[0]
err = p.handleComment(comment)
if err != nil {
// TODO leave comment if error (make configurable)
p.log.Error("error handling comment", zap.Error(err))
commentText := fmt.Sprintf("I ran into a problem working on this:\n```\n%s\n```", err.Error())
err = p.ghClient.RespondToComment(comment.PRNumber, comment.ID, commentText)
@ -188,13 +182,7 @@ func (p pullPalRepo) checkIssuesAndComments() error {
}
func (p *pullPalRepo) handleIssue(issue vc.Issue) error {
/*
err := p.ghClient.CommentOnIssue(issue.Number, "working on it")
if err != nil {
p.log.Error("error commenting on issue", zap.Error(err))
return err
}
*/
// remove labels from issue so that it is not picked up again until labels are reapplied
for _, label := range p.listIssueOptions.Labels {
err = p.ghClient.RemoveLabelFromIssue(issue.Number, label)
if err != nil {
@ -239,7 +227,6 @@ func (p *pullPalRepo) handleIssue(issue vc.Issue) error {
}
// open code change request
// TODO don't hardcode main branch, make configurable
_, url, err := p.ghClient.OpenCodeChangeRequest(changeRequest, changeResponse, newBranchName)
if err != nil {
return err