Skip to content

Support GitHub Enterprise API URLs #4

Description

@gokul-debugger

Problem

The GitHub client supports a configurable API base URL internally, but the CLI and service do not expose it. Users of GitHub Enterprise Server therefore cannot point ContribCheck at their organization instance without writing Python code. The reference parser is also hard-coded to github.com, so even a configured base URL would not accept enterprise issue URLs.

Proposed change

Expose the API endpoint through a CLI option and environment variable, and make issue-reference parsing accept any host.

contribcheck inspect owner/repository#123 --base-url https://github.example.com/api/v3

Acceptance criteria

  • --base-url is supported by the inspect command.
  • GITHUB_API_URL configures the CLI and FastAPI service when the option is absent.
  • Precedence is documented as CLI option, environment variable, then https://api.github.com.
  • URLs are validated as HTTP or HTTPS origins and trailing slashes are handled consistently.
  • parse_issue_reference in src/contribcheck/parsing.py accepts issue URLs on any host (currently it rejects every host except github.com/www.github.com), while still requiring the /owner/repository/issues/N path shape.
  • Authentication headers are sent only to the configured API client.
  • Existing github.com behavior remains unchanged.
  • Mock-transport tests cover default, environment, explicit-option, malformed URL, and non-github.com host behavior.
  • The README documents GitHub Enterprise usage and token expectations.

Security note

Tests and examples must use placeholder hosts and tokens. Do not include credentials or private organization URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions