Skip to content

Commit

Permalink
feat: Add tagging function and create new tags in main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenvanduocit committed Mar 29, 2023
1 parent ee8f871 commit e038d1f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ func main() {

nextTag, err := getNextTag(client, commitMessage, currentTag)
errGuard(client, err)
printNormal("Assistant: " + nextTag)

if err := tag(nextTag); err != nil {
errGuard(client, err)
}

printSuccess("Assistant: New tag " + nextTag + " created")
}
}

Expand Down Expand Up @@ -277,6 +282,18 @@ Be careful, think step by step, but only response the tag name.`
return response, nil
}

func tag(tagName string) error {
workingDir, err := os.Getwd()
if err != nil {
return err
}

return executils.Run("git",
executils.WithDir(workingDir),
executils.WithArgs("tag", tagName),
)
}

func explainError(ctx context.Context, apiClient *GptClient, userError error) (string, error) {
response, err := apiClient.ChatComplete(ctx, []*Message{
{
Expand Down

0 comments on commit e038d1f

Please sign in to comment.