deserialize as array
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 57s

This commit is contained in:
Alexandre Bruyant 2024-01-07 20:15:22 +01:00
parent c269b442ed
commit 5eba7a1634

12
main.go
View File

@ -151,25 +151,21 @@ func main() {
} }
}() }()
githubactions.Infof("Calling node API") githubactions.Infof("Calling node API...")
client := &http.Client{} client := &http.Client{}
res, err := client.Do(req) res, err := client.Do(req)
if err != nil { if err != nil {
githubactions.Fatalf(err.Error()) githubactions.Fatalf(err.Error())
} }
githubactions.Infof("Reading response") githubactions.Infof("Reading response...")
resBody, err := io.ReadAll(res.Body) resBody, err := io.ReadAll(res.Body)
if err != nil { if err != nil {
githubactions.Fatalf(err.Error()) githubactions.Fatalf(err.Error())
} }
githubactions.Infof("Response: %v", string(resBody)) var ipfsAddResponse []AddResponse
var ipfsAddResponse AddResponse
json.Unmarshal(resBody, &ipfsAddResponse) json.Unmarshal(resBody, &ipfsAddResponse)
githubactions.Infof("Upload size is %v", ipfsAddResponse.Bytes) githubactions.Infof("Response: %v", ipfsAddResponse)
githubactions.Infof("CID is %v", ipfsAddResponse.Hash)
githubactions.SetOutput("cid", ipfsAddResponse.Hash)
} }