Closed timrogers closed 2 years ago
You can pass mediaType like this
mediaType: | # The | is significant!
format: raw
I'd suggest we add an example to the README instead of doing the code change?
You can pass mediaType like this
mediaType: | # The | is significant! format: raw
I'd suggest we add an example to the README instead of doing the code change?
Interesting! I didn't know you could pass an object using that format. Let's update the README as you suggest.
I didn't know you could pass an object using that format
it only works because of the way we read out the parameters in this action, it's not a built-in GitHub Actions feature.
This action supports passing a custom
mediaType
, but this doesn't actually work. The action receives a string, butoctokit/endpoint.js
[expects][1] to be passed an object withformat
and/orpreviews
keys.Trying to pass a
mediaType
value as suggested in theaction.yml
leads to aCannot read property 'map' of undefined
error which comes from [endpoint.js
'smerge
function][2] which is assuming that the passedmediaType
will be an object with properties.This fixes the issue by taking the value passed in as
mediaType
and sending it toendpoint.js
asmediaType.format
.There are other potential approaches we could take to this, for example:
accept
option instead for a raw headermediaTypeFormat
andmediaTypePreviews
(or similar)Fixes https://github.com/octokit/request-action/issues/175.
[1]: https://github.com/octokit/endpoint.js#endpointroute-options-or-endpointoptions [2]: https://github.com/octokit/endpoint.js/blob/8266fc12765e94cb966d5104a375631b4efb0dbf/src/merge.ts#L35-L37