diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 1b941ce..6458741 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -239,16 +239,16 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules. req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") - logger.Infof(ctx, "try to get pulls GET "+envAPIURL+"/repos/"+envREPOSITORY+"/pulls?state=open&token=XXXXXX") rsp, err := http.DefaultClient.Do(req) if err != nil { return err } + + buf, _ = io.ReadAll(rsp.Body) if rsp.StatusCode != http.StatusOK { - buf, _ = io.ReadAll(rsp.Body) return fmt.Errorf("unknown error: %s", buf) } - fmt.Printf("%#+v\n", rsp) + if err = json.Unmarshal(buf, &pulls); err != nil { logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err) }