Skip to content

Add enterprise-level custom property definition management #586

Description

Automation and governance workflows need to define and manage custom property schemas at the enterprise level. Enterprise-level custom properties cascade to all organizations within the enterprise, providing a unified metadata layer for repository classification, compliance tagging, and policy enforcement across the entire enterprise.

Request

Desired capability

Full lifecycle management of enterprise-level custom property definitions: create, read, update, delete, and promote from organization. All five value types (string, single_select, multi_select, true_false, url) should be supported. Enterprise admins should be able to define properties centrally and have them apply across all orgs.

Acceptance criteria

  • All enterprise custom property definition endpoints are implemented
  • All five value types are supported: string, single_select, multi_select, true_false, url
  • Properties can be created with all supported options: required, default_value, description, allowed_values, values_editable_by, require_explicit_values
  • Organization-level properties can be promoted to enterprise level
  • Tests create definitions, verify retrieval, update, and clean up — full lifecycle
  • Tests cover all five value types

Technical decisions

API choice: REST API. The enterprise custom properties endpoints provide full CRUD coverage. No GraphQL fallback needed.

Endpoints to implement:

MethodEndpointFunction
GET/enterprises/{enterprise}/properties/schemaGet-GitHubEnterpriseCustomProperty (list all)
GET/enterprises/{enterprise}/properties/schema/{custom_property_name}Get-GitHubEnterpriseCustomProperty -Name (get one)
PUT/enterprises/{enterprise}/properties/schema/{custom_property_name}Set-GitHubEnterpriseCustomProperty (create/update single)
PATCH/enterprises/{enterprise}/properties/schemaSet-GitHubEnterpriseCustomProperty (batch create/update)
DELETE/enterprises/{enterprise}/properties/schema/{custom_property_name}Remove-GitHubEnterpriseCustomProperty
PUT/enterprises/{enterprise}/properties/schema/organizations/{org}/{custom_property_name}/promoteMove-GitHubOrganizationCustomPropertyToEnterprise

Permissions required:

  • Read: "Custom properties" enterprise permissions (read)
  • Write/Delete: "Custom properties" enterprise permissions (write)

Function placement:

  • Public: src/functions/public/Enterprise/CustomProperties/
  • Private: src/functions/private/Enterprise/ (if needed)

Value types supported:

TypeDescriptionallowed_valuesdefault_value
stringFree-textN/Astring or null
single_selectPick oneRequired arraystring or null
multi_selectPick multipleRequired arrayarray or null
true_falseBooleanN/A"true" / "false" or null
urlURLN/Astring or null

Property definition schema:

{
"property_name": "environment",
"value_type": "single_select",
"required": true,
"default_value": "production",
"description": "Prod or dev environment",
"allowed_values": ["production", "development"],
"values_editable_by": "org_actors",
"require_explicit_values": true
}

Class: Reuse or extend GitHubCustomPropertyDefinition class (to be created) with properties: Name, ValueType, Required, DefaultValue, Description, AllowedValues, ValuesEditableBy, RequireExplicitValues, SourceType, Url.

Test approach: Integration tests in tests/Enterprise.Tests.ps1. Tests must:

  1. Create property definitions of each type during setup
  2. Retrieve and validate the definitions
  3. Update a property definition
  4. Promote an org property to enterprise (if org custom properties issue is done first)
  5. Remove all test properties during cleanup

Implementation plan

Classes

  • Create GitHubCustomPropertyDefinition class in src/classes/public/CustomProperties/

Public functions

  • Get-GitHubEnterpriseCustomProperty — list all or get by name (src/functions/public/Enterprise/CustomProperties/)
  • Set-GitHubEnterpriseCustomProperty — create or update single or batch (src/functions/public/Enterprise/CustomProperties/)
  • Remove-GitHubEnterpriseCustomProperty — delete by name (src/functions/public/Enterprise/CustomProperties/)
  • Move-GitHubOrganizationCustomPropertyToEnterprise — promote org property (src/functions/public/Enterprise/CustomProperties/)

Tests

  • Add enterprise custom property lifecycle test in tests/Enterprise.Tests.ps1
  • Test string type: create, get, update, delete
  • Test single_select type: create with allowed values, verify constraints
  • Test multi_select type: create with allowed values, verify array handling
  • Test true_false type: create, verify boolean handling
  • Test url type: create, verify URL handling
  • Test batch create/update with multiple properties
  • Test promote from organization (depends on org custom properties)
  • Cleanup: remove all test properties in AfterAll

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions