Compare commits

...

2 Commits

1 changed files with 5 additions and 6 deletions

11
main.go
View File

@ -67,6 +67,7 @@ func main() {
ctx, err := githubactions.Context()
if err != nil {
githubactions.Fatalf("could not get context: %v", err.Error())
return
}
token := os.Getenv("GITHUB_TOKEN")
@ -75,18 +76,16 @@ func main() {
config, err := ParseActionConfig(*ctx)
if err != nil {
githubactions.Fatalf("%v", err.Error())
return
}
pr, err := createPullRequest(ctx.ServerURL, token, *config)
if err != nil {
githubactions.Fatalf("Error while creating pr: %v", err.Error())
return
}
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 +233,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)