From d2824ce7e4e92184149386fd6869f0cc11ce5246 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 6 Jan 2024 19:54:00 +0100 Subject: [PATCH] Attempt to add more logging --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 1455708..538823c 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,8 @@ type AddResponse struct { } func main() { + githubactions.Infof("Checking inputs...") + // Check inputs path := githubactions.GetInput("path_to_add") if path == "" { @@ -53,6 +55,8 @@ func main() { githubactions.Fatalf("%v is not a directory", path) } + githubactions.Infof("Inputs OK") + body, writer := io.Pipe() // TODO: URL @@ -68,6 +72,7 @@ func main() { req.Header.Add("Content-Type", mwriter.FormDataContentType()) err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error { + githubactions.Infof("Reading %v", innerPath) if err != nil { return err } @@ -100,12 +105,14 @@ func main() { } }() + githubactions.Infof("Calling node API") client := &http.Client{} res, err := client.Do(req) if err != nil { githubactions.Fatalf(err.Error()) } + githubactions.Infof("Reading response") resBody, err := io.ReadAll(res.Body) if err != nil { githubactions.Fatalf(err.Error()) @@ -114,5 +121,7 @@ func main() { var ipfsAddResponse AddResponse json.Unmarshal(resBody, &ipfsAddResponse) + githubactions.Infof("Upload size is %v", ipfsAddResponse.Bytes) + githubactions.Infof("CID is %v", ipfsAddResponse.Hash) githubactions.SetOutput("cid", ipfsAddResponse.Hash) }