Skip to content

Add GitHub Enterprise Server support #33

@nissessenap

Description

@nissessenap

Summary

Add support for GitHub Enterprise Server (GHES) by allowing users to configure a custom GitHub API base URL.

Background

The GithubAPIURL option was removed during the ghinstallation refactor (PR #32). While the previous implementation wasn't properly wired up, the option should be restored and correctly integrated for users running GHES.

What needs to change

API server (pkg/api/)

  • Add GithubAPIURL back to Options in server.go
  • Add GithubAPIURL CLI flag/env var back to APICmd in cmd/shepherd/api.go
  • In NewGitHubClient(), set AppsTransport.BaseURL when a custom URL is provided
  • ghinstallation supports this via ghinstallation.NewAppsTransportWithOptions() or setting atr.BaseURL after creation

GitHub adapter (pkg/adapters/github/)

  • Add GithubAPIURL to adapter Options
  • Pass it through to the GitHub client constructor
  • The adapter's Client already uses go-github's WithEnterpriseURLs() for the comment-posting client

CLI (cmd/shepherd/main.go)

  • Add GithubAPIURL flag with default:"https://api.github.com" and env:"SHEPHERD_GITHUB_API_URL" to both APICmd and GitHubCmd

Acceptance criteria

  • Both API server and GitHub adapter accept a --github-api-url / SHEPHERD_GITHUB_API_URL flag
  • When set, ghinstallation targets the custom URL for token generation
  • When set, the adapter's GitHub client targets the custom URL for comments
  • Default behavior (public GitHub) remains unchanged when the option is empty or set to https://api.github.com
  • Tests cover custom URL wiring

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions