Repository navigation
Add repository-level custom property value management and integration tests #588
Description
Repository owners and automation workflows need to read and set custom property values on individual repositories. While property definitions are managed at the organization or enterprise level, values can be set at the repository level by repo admins or users with the edit custom property values permission. The module currently has Get-GitHubRepositoryCustomProperty but lacks the ability to set values, and the existing function needs integration tests.
Request
Desired capability
Complete repository-level custom property value management: get and set property values on individual repositories. The Get- function already exists but needs proper integration tests that own their lifecycle (create definitions at org level, set values, read back, validate types including multi-select array preservation, clean up). A Set- function is needed to assign or unset values.
Acceptance criteria
Set-GitHubRepositoryCustomPropertyis implemented to create/update values on a single repo- Unsetting a property (setting value to
null) is supported - All five value types work correctly:
string,single_select,multi_select,true_false,url - Multi-select values are preserved as
[string[]]arrays (the fix from 🪲 [Fix]: Multi-select custom properties no longer lose individual values #577) - Integration tests own their full lifecycle: create org-level definitions → set values on repo → read back → validate → update → unset → clean up definitions
- Tests cover all five value types including multi-select array preservation
- The existing
Get-GitHubRepositoryCustomPropertyfunction has proper test coverage
Technical decisions
API choice: REST API. The repository custom properties endpoints provide get and set for values.
Endpoints:
| Method | Endpoint | Function | Status |
|---|---|---|---|
GET |
/repos/{owner}/{repo}/properties/values |
Get-GitHubRepositoryCustomProperty |
Exists — needs tests |
PATCH |
/repos/{owner}/{repo}/properties/values |
Set-GitHubRepositoryCustomProperty |
New |
Permissions required:
- Read:
"Metadata" repository permissions (read)— works unauthenticated for public repos - Write:
"Custom properties" repository permissions (write)
Function placement:
- Public:
src/functions/public/Repositories/CustomProperties/
Set payload:
{
"properties": [
{ "property_name": "environment", "value": "production" },
{ "property_name": "topics", "value": ["api", "module", "automation"] },
{ "property_name": "archived", "value": null }
]
}Setting value to null unsets (removes) the property from the repository.
Dependency on org-level definitions: Property values can only be set if the corresponding definition exists at the organization (or enterprise) level. Tests must first create definitions using the org-level functions from #587, then set and read values.
Class: The existing GitHubCustomProperty class handles the value response correctly (including multi-select array preservation from #577). No class changes needed.
Test approach: Integration tests in tests/Repositories.Tests.ps1 within the organization context (-Skip:($OwnerType -ne 'organization')). Tests require org-level property definitions as prerequisites, so they should:
- Create org-level property definitions in
BeforeAll(one of each type) - Set values on the test repository
- Read back values using
Get-GitHubRepositoryCustomProperty - Validate types (especially multi-select as
[string[]]) - Update values
- Unset values using null
- Remove org-level definitions in
AfterAll
Note
This issue depends on #587 (Organization Custom Properties) for the org-level definition management functions used in test setup/cleanup. If #587 is not yet implemented, the test setup can use raw Invoke-GitHubAPI calls temporarily.
Implementation plan
Public functions
-
Set-GitHubRepositoryCustomProperty— create/update/unset values on a single repo (src/functions/public/Repositories/CustomProperties/)
Tests
- Add repo custom property lifecycle test in
tests/Repositories.Tests.ps1(org context only) - BeforeAll: Create org-level property definitions (one of each type:
string,single_select,multi_select,true_false,url) - Test
Set-GitHubRepositoryCustomProperty— setstringvalue, read back - Test
Set-GitHubRepositoryCustomProperty— setsingle_selectvalue, read back - Test
Set-GitHubRepositoryCustomProperty— setmulti_selectvalue (array), read back, verify[string[]]type - Test
Set-GitHubRepositoryCustomProperty— settrue_falsevalue, read back - Test
Set-GitHubRepositoryCustomProperty— seturlvalue, read back - Test
Set-GitHubRepositoryCustomProperty— unset value with$null, verify removed - Test
Get-GitHubRepositoryCustomProperty— validates all returned properties have correct Name and typed Value - Test
Get-GitHubRepository.CustomPropertiesproperty — verify it populates from both REST and GraphQL paths - AfterAll: Remove org-level property definitions
Cleanup from #577
- Remove the best-effort integration test added in 🪲 [Fix]: Multi-select custom properties no longer lose individual values #577 (replace with the full lifecycle test above)
- Remove the
#SkipTest:FunctionTest:Will add a test for this function in a future PRannotation fromGet-GitHubRepositoryCustomProperty.ps1
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity