Description
Problem overview
We started using githubs custom properties recently and noticed that our reviewdog/action-actionlint checks started to fail with the following error:
reviewdog: failed to build repo base HTML URL: json: cannot unmarshal array into Go struct field Repository.custom_properties of type string
reviewdog/action-actionlint uses reviewdog/reviewdog which in turn uses the current version of google/go-github to parse github related json.
Analysis
Handling for custom_properties
was added in this PR: #3065.
The field is expected to be a map of string values (https://github.com/google/go-github/pull/3065/files#diff-7a0544e44d81e972917728b13efd3fa55e7f9d1bd8edb745216494fa1e178f93R80).
The actual api response can also include non-string values. The following is part of an actual api response obtained by using the github cli (gh api repos/OWNER/REPO
):
The custom property technologies
is multi select and github seems to return the selected values as an array which causes the parser to error out. The custom property org-managed-rulesets
is of type boolean and represented using a string by github.
Sadly, githubs api docs are really bad when it comes to custom_property
, so I can't say for sure if there are other output options than string or array of strings:
{
// ...
"custom_properties": {
"type": "object",
"description": "The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values.",
"additionalProperties": true
}
// ...
}