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

This commit is contained in:
CrispyBaguette 2024-01-08 07:53:00 +01:00
parent 91812ef33c
commit 8fd01e2798

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
}
} }
} }