Skip to content

Add organization-level custom property definition and value management #587

@MariusStorhaug

Description

Organization administrators need to define, manage, and assign custom property schemas and values for repositories within their organization. Custom properties enable metadata-driven governance, search filtering, and automation rules based on repository classification (e.g., environment, team ownership, compliance tier).

Request

Desired capability

Full lifecycle management of organization-level custom property definitions and the ability to assign values to repositories in bulk. This includes creating property schemas (with all five value types), querying definitions, listing property values across all org repos, setting values on repos in batch, and removing definitions.

Acceptance criteria

  • All organization custom property schema endpoints are implemented (CRUD)
  • Bulk value assignment to repositories is supported (up to 30 repos per call)
  • Listing property values across all org repositories is supported with pagination and query filtering
  • All five value types work: string, single_select, multi_select, true_false, url
  • Properties can be created with all options: required, default_value, description, allowed_values, values_editable_by, require_explicit_values
  • Tests create definitions of each type, assign values to repos, verify retrieval, update, unset (null), and clean up

Technical decisions

API choice: REST API. The organization custom properties endpoints provide complete CRUD for both definitions and values. No GraphQL fallback needed.

Endpoints to implement:

Method Endpoint Function
GET /orgs/{org}/properties/schema Get-GitHubOrganizationCustomProperty (list all definitions)
GET /orgs/{org}/properties/schema/{custom_property_name} Get-GitHubOrganizationCustomProperty -Name (get one)
PUT /orgs/{org}/properties/schema/{custom_property_name} Set-GitHubOrganizationCustomProperty (create/update single)
PATCH /orgs/{org}/properties/schema Set-GitHubOrganizationCustomProperty (batch create/update)
DELETE /orgs/{org}/properties/schema/{custom_property_name} Remove-GitHubOrganizationCustomProperty
GET /orgs/{org}/properties/values Get-GitHubOrganizationCustomPropertyValue (list values for all repos)
PATCH /orgs/{org}/properties/values Set-GitHubOrganizationCustomPropertyValue (batch set values on repos)

Permissions required:

  • Schema read: "Custom properties" organization permissions (read)
  • Schema write/delete: "Custom properties" organization permissions (admin)
  • Values read: "Custom properties" organization permissions (read)
  • Values write: "Custom properties" organization permissions (write)

Function placement:

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

Value types supported:

Type Description allowed_values default_value
string Free-text N/A string or null
single_select Pick one Required array string or null
multi_select Pick multiple Required array array or null
true_false Boolean N/A "true" / "false" or null
url URL N/A string or null

Batch value assignment payload:

{
  "repository_names": ["Hello-World", "octo-repo"],
  "properties": [
    { "property_name": "environment", "value": "production" },
    { "property_name": "service", "value": "web" }
  ]
}

Setting value to null unsets the property on those repositories.

Query parameter for value listing: repository_query supports the same qualifiers as GitHub search.

Class: Reuse GitHubCustomPropertyDefinition class from enterprise issue (#586). Add GitHubRepositoryCustomPropertyValues class for the values list response (contains RepositoryID, RepositoryName, RepositoryFullName, Properties).

Test approach: Integration tests in tests/Organizations.Tests.ps1 using the org auth case. Tests must own their full lifecycle:

  1. Create property definitions of each type during setup
  2. Assign values to test repos
  3. Retrieve definitions and values, validate types
  4. Update values (including multi-select arrays)
  5. Unset values using null
  6. Remove definitions during cleanup

Implementation plan

Classes

Public functions — Schema management

  • Get-GitHubOrganizationCustomProperty — list all or get by name (src/functions/public/Organization/CustomProperties/)
  • Set-GitHubOrganizationCustomProperty — create or update single or batch
  • Remove-GitHubOrganizationCustomProperty — delete by name

Public functions — Value management

  • Get-GitHubOrganizationCustomPropertyValue — list property values for all org repos (with pagination and query)
  • Set-GitHubOrganizationCustomPropertyValue — batch assign values to repos (up to 30 repos)

Tests

  • Add org custom property lifecycle test in tests/Organizations.Tests.ps1
  • Create string property definition, assign value, read back
  • Create single_select property with allowed values, assign, verify
  • Create multi_select property, assign array value, verify array preservation
  • Create true_false property, assign, verify
  • Create url property, assign, verify
  • Test batch assignment to multiple repos
  • Test unset (null value) removes property from repo
  • Test Get-GitHubOrganizationCustomPropertyValue with repository_query filter
  • Cleanup: remove all test property definitions in AfterAll

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions