Skip to content

Feature Request: Add ApiBaseUrl parameter to Set-GitHubConfiguration Feature Request: Add ApiBaseUrl parameter to Set-GitHubConfiguration to support GITHUB_API_URL directly (GitHub Data Residency / ghe.com) #450

Description

@felickz

Feature Idea Summary

Add a new ApiBaseUrl configuration parameter to Set-GitHubConfiguration that accepts a
full API base URL (e.g. directly from $env:GITHUB_API_URL) so that callers do not need to
manually manipulate the URL to extract a bare hostname before configuring the module.

Feature Idea Additional Details

GitHub runners set the GITHUB_API_URL environment variable to the correct API base URL for
the current GitHub instance:

Platform GITHUB_API_URL Current PSFG ApiHostName workaround
GitHub.com (GHEC) https://api.github.com n/a (default)
GitHub Data Residency (*.ghe.com) https://api.<tenant>.ghe.com Strip https://api.<tenant>.ghe.com
GitHub Enterprise Server (GHES) https://<hostname>/api/v3 Strip https:// and /api/v3<hostname>

This string manipulation is fragile and must be reimplemented by every caller that wants
multi-platform support across all three GitHub deployment types.

Requested addition:

Set-GitHubConfiguration -ApiBaseUrl $env:GITHUB_API_URL

This would allow the module to internally derive the correct URL construction strategy,
so callers don't need to understand PSFG's hostname/path conventions.

Notes:

  • The existing ApiHostName validation already correctly rejects https: and api. prefixes
    (via [ValidatePattern('^(?!https?:)(?!api\.)(?!www\.).*')]), so a separate ApiBaseUrl
    parameter is the right approach rather than relaxing existing validation.
  • GitHub Data Residency (*.ghe.com) technically also responds at <tenant>.ghe.com/api/v3,
    so ApiHostName can be made to work via string manipulation, but this is an undocumented
    implementation detail that callers should not need to rely on.
  • Real-world impact: consumers of this module targeting GitHub Data Residency are currently
    forced to bypass PSFG's host configuration entirely and pass absolute URIs directly to
    Invoke-GHRestMethod. See: Support GitHub Enterprise Cloud with data residency (ghe.com) advanced-security/secret-scanning-review-action#71

Requested Assignment

Operating System

N/A

PowerShell Version

N/A

Module Version

N/A

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn issue or pull request introducing new functionality to the project.triage neededAn issue that needs to be reviewed by a member of the team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions