Fix github logic

* Allow multiple commits to be made back to back (worktre wasn't being
  set to nil after commit created)
* Allow PR to be created even if title is not provided (i.e. because
  'code change request' was skipped)
This commit is contained in:
Moby von Briesen 2023-04-22 22:54:00 -04:00
parent 529b720eb6
commit b29f544c23

View File

@ -95,6 +95,9 @@ func (gc *GithubClient) OpenCodeChangeRequest(req llm.CodeChangeRequest, res llm
// TODO handle gc.ctx canceled
title := req.Subject
if title == "" {
title = "update files"
}
branchName := randomBranchName()
branchRefName := plumbing.NewBranchReferenceName(branchName)
baseBranch := "main"
@ -271,6 +274,12 @@ func (gc *GithubClient) FinishCommit(message string) error {
When: time.Now(),
},
})
if err != nil {
return err
}
// set worktree to nil so a new commit can be started
gc.worktree = nil
return nil
}