output CID
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 53s

This commit is contained in:
Alexandre Bruyant 2024-01-08 08:01:04 +01:00
parent 5247ffd083
commit 97e0a69474

15
main.go
View File

@ -167,13 +167,22 @@ func main() {
githubactions.Debugf("Response: %v", string(resBody)) githubactions.Debugf("Response: %v", string(resBody))
d := json.NewDecoder(res.Body) d := json.NewDecoder(res.Body)
addResponses := make([]*AddResponse, 0)
for { for {
var ipfsAddResponse []AddResponse var addResponse AddResponse
if err := d.Decode(&ipfsAddResponse); err == io.EOF { if err := d.Decode(&addResponse); err == io.EOF {
break break
} else if err != nil { } else if err != nil {
githubactions.Warningf("Failed to unmarshal response: %v", fmt.Errorf("%w", err)) githubactions.Warningf("Failed to unmarshal response: %v", fmt.Errorf("%w", err))
} }
githubactions.Debugf("Unmarshaled response: %v", ipfsAddResponse) githubactions.Debugf("Unmarshaled response: %v", addResponse)
addResponses = append(addResponses, &addResponse)
}
for _, addResponse := range addResponses {
if (*addResponse).Name == path {
githubactions.SetOutput("cid", addResponse.Hash)
break
}
} }
} }