In our repo there are some custom project fields set up which I assume is what GitHub refers to as the custom properties. When trying https://api.github.com/repos/OWNER/REPO/properties/values as indicated on https://docs.github.com/en/rest/repos/custom-properties?apiVersion=2022-11-28#get-all-custom-property-values-for-a-repository I'm getting an empty array though the properties are there in the repo. The github token has all the needed permissions unless I missed some. Please see the image.
I'm getting all the projects fields with GraphQL at https://api.github.com/graphql but not with REST at https://api.github.com/repos/.../.../properties/values.
What did I miss or how to fix it?
Custom fields in projects are different from custom properties for repositories.
The REST API doesn't offer access to the custom project fields, they're only available via GraphQL. If you use the GitHub CLI, you can retrieve them like this:
gh project field-list "$project_number" \
--owner "$your_organization" --format json
returning something like
{
"fields": [
{
"id": "PVTF_lADOAYq0pM4AmSgNzgeMdWY",
"name": "Title",
"type": "ProjectV2Field"
},
{
"id": "PVTF_lADOAYq0pM4AmSgMzgeNdWc",
"name": "Assignees",
"type": "ProjectV2Field"
}
],
// ...
"totalCount": 12
}
If you want to see the actual GraphQL request, you can set GH_DEBUG=api
in the environment before running the gh
command.