Skip to content

🚀 [Feature]: Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository#555

Open
Copilot wants to merge 11 commits intomainfrom
copilot/use-repository-custom-properties
Open

🚀 [Feature]: Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository#555
Copilot wants to merge 11 commits intomainfrom
copilot/use-repository-custom-properties

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

GitHub's GraphQL API now exposes custom properties directly on the Repository type via repositoryCustomPropertyValues. This eliminates the need for a separate REST call to Get-GitHubRepositoryCustomProperty when fetching repositories.

Changes

  • PropertyToGraphQLMap: Added GraphQL query repositoryCustomPropertyValues(first: 100) { nodes { propertyName value } }
  • GraphQL constructor: Transform GraphQL response format (propertyName/value) to PascalCase (Name/Value) for PowerShell conventions
  • REST constructor: Transform REST API format (property_name/value) to PascalCase (Name/Value) for consistency

Result

# CustomProperties now populated directly with PascalCase properties
Get-GitHubRepository -Owner 'PSModule' -Name 'GitHub' | Select-Object Name, CustomProperties

# Name   CustomProperties
# ----   ----------------
# GitHub {@{Name=Type; Value=Module}}

The standalone Get-GitHubRepositoryCustomProperty function remains useful for fetching only custom properties without the full repository object.

Original prompt

This section details on the original issue you should resolve

<issue_title>Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository</issue_title>
<issue_description>## Summary

GitHub's GraphQL API now exposes custom properties directly on the Repository type via the repositoryCustomPropertyValues connection field. This means Get-GitHubRepository can return custom properties inline — eliminating the need for a separate REST call via Get-GitHubRepositoryCustomProperty.

Current behavior

  • Get-GitHubRepository uses GraphQL to fetch repositories, but CustomProperties is always $null because the PropertyToGraphQLMap maps CustomProperties to '' (empty string) and the GraphQL constructor never populates it.
  • To get custom properties, users must make a separate call: Get-GitHubRepositoryCustomProperty -Owner <owner> -Repository <repo>, which uses the REST endpoint GET /repos/{owner}/{repo}/properties/values.

GraphQL schema discovery

Schema introspection confirms two fields on the Repository type:

Field Type Description
repositoryCustomPropertyValue RepositoryCustomPropertyValue A single custom property value
repositoryCustomPropertyValues RepositoryCustomPropertyValueConnection A paginated list of custom property values

The connection node type RepositoryCustomPropertyValue has:

  • propertyName (String!)
  • value (String!)

Example query

{
  repository(owner: "PSModule", name: "GitHub") {
    repositoryCustomPropertyValues(first: 100) {
      nodes {
        propertyName
        value
      }
    }
  }
}

Returns:

{
  "propertyName": "Type",
  "value": "Module"
}

Proposed changes

  1. GitHubRepository.PropertyToGraphQLMap — Update the CustomProperties entry from '' to:

    'repositoryCustomPropertyValues(first: 100) { nodes { propertyName value } }'
    
  2. GitHubRepository GraphQL constructor — Add logic to populate $this.CustomProperties from the GraphQL response, converting the nodes array into the same shape as the REST API returns (or a suitable hashtable/PSCustomObject).

  3. Consider whether Get-GitHubRepositoryCustomProperty should remain as a standalone function for cases where users only need custom properties without fetching the full repository object (it may still be useful).

References

Comments on the Issue (you are Copilot in this section)

Custom agent used: PR Manager
Create a pull request with a release note style description, appropriate title, and labels based on the change type.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Get-GitHubRepository to use repositoryCustomPropertyValues 🚀 [Feature]: Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository Feb 19, 2026
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review February 19, 2026 08:07
Copilot AI review requested due to automatic review settings February 19, 2026 08:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the GitHubRepository class to populate CustomProperties directly from GitHub's GraphQL API using the newly available repositoryCustomPropertyValues field, eliminating the need for separate REST API calls to retrieve custom properties.

Changes:

  • Added GraphQL query fragment for repositoryCustomPropertyValues to fetch up to 100 custom properties
  • Implemented transformation logic in both REST and GraphQL constructors to normalize custom property format to PascalCase (Name/Value)
  • Maintained consistency between REST (property_name/value) and GraphQL (propertyName/value) API response formats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Use repositoryCustomPropertyValues GraphQL field to populate CustomProperties on GitHubRepository

2 participants

Comments