Repository navigation
feat: Add custom_properties to github_repository and github_enterpris… - #3322
faradayfan wants to merge 3 commits into
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
9efa7f0 to
c96926f
Compare
c96926f to
b702889
Compare
|
Just to be transparent, I haven't tested these changes manually. They are based on API documentation. I'm planning on testing the repository resource changes, but I don't think I'll be able to test the enterprise custom properties. Is that something a maintainer can validate for me? Or is there a manual testing harness I can use to validate those changes myself? |
|
We're super-interested in this change, and have Enterprise waiting for this automation. If we can help with testing it, just let us know, I'll try to do it. |
9a9d13c to
3bb27d2
Compare
|
I've validated the custom_properties property on the github_repository resource through manual testing and provided a breakdown of the behavior on the PR summary. |
|
Hey @faradayfan did you find a workaround in the meantime? |
…e_custom_property resource (integrations#3230, integrations#3304) Allow custom properties to be set on repositories at creation time, fixing 422 errors when an organization enforces required custom properties. Adds a new github_enterprise_custom_property resource and data source for managing custom property definitions at the enterprise level. Uses context-aware CRUD functions, proper 404 handling, and ConfigStateChecks in acceptance tests per maintainer guidelines. Closes integrations#3230, integrations#3304
- include custom_properties in create request body to satisfy org-required property enforcement at creation time - read custom_properties via dedicated GetAllCustomPropertyValues endpoint instead of repo.CustomProperties (which GET /repos never populates) - handle partial and full removal in update via CreateOrUpdateCustomProperties with null values; removing the block entirely leaves existing values intact (Optional+Computed behavior)
Covers all documented config semantics: setting at creation time, updating values, removing individual map keys, clearing via empty map, and the Optional+Computed no-op when the block is removed entirely.
3bb27d2 to
1e533eb
Compare
No workarounds for repo creation when there are required custom properties. |
|
There were merge conflicts. So I rebased and address the merge conflicts manually. @deiga, do you have an idea on when these changes can be merged and released? |
|
Hello Team, kindly request that you prioritize this issue, as it is impacting me as well and appears to be affecting many users. Your prompt attention and support in resolving this issue would be greatly appreciated. |
deiga
left a comment
There was a problem hiding this comment.
Please adhere to our Contributing guidelines before asking for a review, you're using outdated functions and patterns everywhere
There was a problem hiding this comment.
Please delete this file and use the default template instead
There was a problem hiding this comment.
Please delete this file and use the default template instead
| return &schema.Resource{ | ||
| Description: "Use this data source to retrieve information about a custom property definition for a GitHub enterprise.", | ||
|
|
||
| ReadContext: dataSourceGithubEnterpriseCustomPropertyRead, |
There was a problem hiding this comment.
Please add a Timeouts block
| defaultValues = vals | ||
| } | ||
| } else { | ||
| if val, ok := property.DefaultValueString(); ok { |
There was a problem hiding this comment.
issue: You're missing DefaultValueBool
| } | ||
| } | ||
|
|
||
| d.SetId(buildTwoPartID(enterpriseSlug, propertyName)) |
There was a problem hiding this comment.
| d.SetId(buildTwoPartID(enterpriseSlug, propertyName)) | |
| d.SetId(buildID(enterpriseSlug, propertyName)) |
| UpdateContext: resourceGithubEnterpriseCustomPropertiesUpdate, | ||
| DeleteContext: resourceGithubEnterpriseCustomPropertiesDelete, | ||
| Importer: &schema.ResourceImporter{ | ||
| StateContext: schema.ImportStatePassthroughContext, |
| }, | ||
| "required": { | ||
| Type: schema.TypeBool, | ||
| Optional: true, |
| return diag.FromErr(err) | ||
| } | ||
|
|
||
| d.SetId(buildTwoPartID(enterpriseSlug, propertyName)) |
There was a problem hiding this comment.
| d.SetId(buildTwoPartID(enterpriseSlug, propertyName)) | |
| d.SetId(buildID(enterpriseSlug, propertyName)) |
feat: Add custom_properties to github_repository and github_enterprise_custom_property resource
Allow custom properties to be set on repositories at creation time, fixing 422 errors when an organization enforces required custom properties. Also adds a new github_enterprise_custom_property resource and data source for managing custom property definitions at the enterprise level.
Resolves #3230
Resolves #3304
Before the change?
github_repositoryto return a 422 error on creation, since custom properties could only be set via a separategithub_repository_custom_propertyresource applied after creationAfter the change?
github_repositorynow accepts acustom_propertiesargument (a string map) that is included in the initial repository creation request, satisfying organization-required custom properties at creation timegithub_enterprise_custom_propertyresource allows managing custom property definitions at the enterprise level, mirroring the existinggithub_organization_custom_propertiesresourcegithub_enterprise_custom_propertydata source allows reading enterprise custom property definitionsgithub_repositorywith a new argument description and exampletestResourcePrefixnaming andConfigStateCheckspatternPull request checklist
Does this introduce a breaking change?
Behavior Note About
custom_propertiesongithub_repositoryThis change adds a
custom_propertiesattribute togithub_repositorythat allows setting repository-level custom property values defined by the organization.Example
Behavior
Create — Custom properties are included directly in the
POST /orgs/{org}/reposrequest body. This satisfies organizations that enforce required custom properties at repository creation time (which would otherwise reject the request with a422).Update — Changes are applied via the dedicated
PATCH /repos/{owner}/{repo}/properties/valuesendpoint. The general repository update endpoint (PATCH /repos/{owner}/{repo}) silently ignores custom property changes, so the dedicated endpoint is required.Read — Property values are refreshed from
GET /repos/{owner}/{repo}/properties/valueson each plan so out-of-band changes are detected as drift.Config semantics
custom_properties = { key = "value" }null)custom_properties = {}custom_propertiesblockThe last row is intentional and follows Terraform's
Optional + Computedconvention: org-required properties shouldn't be implicitly cleared, and accidental block removal shouldn't wipe values. Usecustom_properties = {}to explicitly clear all values.