Fix behaviour if the PR does already exists

This commit is contained in:
Julien Fastré 2024-03-08 12:54:52 +01:00
parent 10b487d09d
commit 45a64e18f4
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
1 changed files with 2 additions and 6 deletions

View File

@ -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)