Allow to set a token from input (#1)

Reviewed-on: #1
Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop>
Co-committed-by: Julien Fastré <julien.fastre@champs-libres.coop>
This commit is contained in:
2024-03-11 11:26:05 +00:00
committed by Julien Fastré
parent 8f676ccb15
commit 3e47a24f8d
3 changed files with 38 additions and 3 deletions

View File

@@ -69,8 +69,9 @@ func main() {
githubactions.Fatalf("could not get context: %v", err.Error())
}
token := os.Getenv("GITHUB_TOKEN")
token := githubactions.GetInput("token")
fmt.Printf("Api url is %v\n", ctx.ServerURL)
fmt.Printf("Debug: token length is %d characters\n", len(token))
config, err := ParseActionConfig(*ctx)
if err != nil {
@@ -125,7 +126,7 @@ func (a *Agent) ExistingOpenPullRequest(config CreatePrConfig) (bool, *gitea.Pul
gitea.ListPullRequestsOptions{State: gitea.StateOpen, ListOptions: gitea.ListOptions{Page: currentPage}})
if err != nil {
return false, nil, err
return false, nil, fmt.Errorf("error while listing all exisiting open pull requests: %v", err.Error())
}
for _, pull := range pulls {