terraform-provider-github
terraform-provider-github copied to clipboard
[FEAT]: Support GitHub repository custom properties
Describe the need
GitHub just announced the feature of GitHub repository custom properties. We can use the information of custom properties to apply rules to repository in GitHub organization(s). It would be good to support the feature in the terraform provider as well. By doing that, we will be able to manage custom properties and rule sets in terraform.
https://github.blog/changelog/2023-10-12-github-repository-custom-properties-beta/
SDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Unfortunately, this feature is not released on the API yet. Once support is added in the API, we can implement it in the provider.
Looks like a REST API is in public beta now. Is that enough to get started? Thanks!
Ideally there would be more than just a GET. We could make a data source with the existing endpoint, but not a full resource.
There are more endpoints here (incl. creation): https://docs.github.com/en/rest/orgs/custom-properties?apiVersion=2022-11-28
Ahh my mistake, thanks for correcting me!
Hey, do you guys plan on adding this in an upcoming provider update?
GitHub's SDK team unfortunately does not have the bandwidth to take this on ourselves, though we're very receptive of PRs!
@kfcampbell I'll make an attempt to PR soon, just drafted init. But I might just found some blockers of GitHub API didn't respond custom property id, because on resource update I got an error of expected numerical ID. strconv.ParseInt: parsing, but no ID on the api.
If you can give a bit of hint, on the draft PR I have, that would be superb
Hi, I also need to support custom properties for repositories. However, it needs to update go-github. So, I created the issue: https://github.com/integrations/terraform-provider-github/issues/2187
This would be a welcome addition.
It's worth noting that we (GitHub's SDK team) are working on a Go SDK generated from GitHub's OpenAPI specification. It includes all routes published in the GitHub API, so coverage doesn't need to be added manually. I've been looking for an excuse to add it to the project; this could be it.
I have a client that will need this very soon. If I can help fast-track this by contributing I can put some hours in this. I see there is already a PR opened and some discussions around the Go SDK, is there anything I can do here?
Any update on this feature?
Any update on this feature?
I wouldnt mind contributing for this feature as soon as the go-github client is bumped to v60. But that PR looks a bit stuck...
Now the go-github PR has been merged is there potential for any progress on this feature soon? Thanks!
https://github.com/integrations/terraform-provider-github/pull/2107 only pertains to the Organization level custom properties (and looks a bit stale), while the ditto on the repository level hasn't been worked on from what I can tell. I've started working on it in https://github.com/integrations/terraform-provider-github/pull/2316 but gotten stuck due to each available SDK lacking in functionality in regards to repository custom properties:
google/go-github- https://github.com/google/go-github/issues/3198octokit/go-sdk(GitHub's autogenerated SDK from the OpenAPI spec) - https://github.com/octokit/go-sdk/issues/90
Once I see some progress in either of those areas I'll revisit that PR
Any update so far? Thank you!!
#2316 is blocked by #2443
#2316 is blocked by #2443
Now that #2443 is merged, do you have an ETA on this feature request?
Thanks
Hello, I'd like to be able to manage custom properties during repo creation as well. The API allows to provide properties just like it allows to provide Topics when creating a repository. Do you think we could imagine adding the feature in your PR to implement a full custom property support or do you prefer me to open an additional pull request to handle it?
Here also...
Hello, I'd like to be able to manage custom properties during repo creation as well. The API allows to provide properties just like it allows to provide Topics when creating a repository. Do you think we could imagine adding the feature in your PR to implement a full custom property support or do you prefer me to open an additional pull request to handle it?
Another PR. #2316 is big enough as it is
Any update on this feature request? Looks like progress has been made on #2316 but stalled for the past few weeks...
This was released in 6.5.0
https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_custom_property
For anyone interested... To set custom properties on repository using GitHub App, Read-Write permission is needed on organization; yes, really.
The missing permission on the App will get you:
│ Error: PATCH https://api.github.com/repos/{owner}/{repo}/properties/values: 422 Actor doesn't have permissions to edit properties [{propName}] []
│
│ with github_repository_custom_property.this["{propName}"],
│ on custom_properties.tf line 8, in resource "github_repository_custom_property" "this":
│ 8: resource "github_repository_custom_property" "this" {
For anyone interested... To set custom properties on repository using GitHub App, Read-Write permission is needed on organization; yes, really.
The missing permission on the App will get you:
│ Error: PATCH https://api.github.com/repos/{owner}/{repo}/properties/values: 422 Actor doesn't have permissions to edit properties [{propName}] [] │ │ with github_repository_custom_property.this["{propName}"], │ on custom_properties.tf line 8, in resource "github_repository_custom_property" "this": │ 8: resource "github_repository_custom_property" "this" {
Hey @meridius how are you ? Which permission of organization I need to set on my GitHub App then ? Do you know why read-write on the custom propertie isn't enough ? Is a bug ?
Hey @FedeBerbara, as I wrote - your GH App needs to have R/W for custom props on Org.