From 45a64e18f41cfac5c2a2c207e2ae7a18e70f6b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 8 Mar 2024 12:54:52 +0100 Subject: [PATCH] Fix behaviour if the PR does already exists --- main.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 12ff557..11824e1 100644 --- a/main.go +++ b/main.go @@ -82,11 +82,7 @@ func main() { githubactions.Fatalf("Error while creating pr: %v", err.Error()) } - if pr != nil { - fmt.Printf("Created PR with id %d\n", pr.ID) - } else { - fmt.Printf("No PR created\n") - } + fmt.Printf("Created PR with id %d\n", pr.ID) githubactions.SetOutput("pull-request-number", strconv.FormatInt(pr.Index, 10)) githubactions.SetOutput("pull-request-url", pr.URL) @@ -234,7 +230,7 @@ func createPullRequest(apiUrl string, token string, config CreatePrConfig) (*git } if has { - return nil, nil + return nil, errors.New("PR already exists for this head branch") } pr, err := agent.createPullRequestGitea(config)