Skip to content

Conversation

Copy link

Copilot AI commented Oct 8, 2025

Overview

This PR adds support for GitHub Enterprise Server (GHES) by introducing a new --server-url parameter that allows users to specify custom GitHub server URLs. This enables the tool to work with on-premises GHES installations in addition to GitHub.com.

Changes

New Parameter

  • Added --server-url command-line argument with default value https://api.github.com
  • For GHES installations, users can specify https://HOSTNAME/api/v3 format
  • Fully backward compatible - existing users don't need to change anything

Updated Functions

Updated all GitHub API functions in github.py to accept and use the server_url parameter:

  • get_orgs_in_ent() - constructs GraphQL endpoint based on server URL
  • get_ghas_status_for_repos() - uses server URL for REST API calls
  • get_active_committers_in_last_90_days() - uses server URL for GraphQL calls
  • process_organizations(), get_organizations(), add_active_committers() - pass server URL through call chain

Documentation

  • Updated README with GHES usage instructions and examples
  • Added dedicated "GitHub Enterprise Server (GHES)" section
  • Updated help output to include the new parameter

Testing

  • Added comprehensive unit tests (tests/test_ghes_support.py) to verify:
    • Custom server URLs are properly used for REST and GraphQL endpoints
    • Default GitHub.com URL continues to work
    • All existing tests remain passing

Usage Examples

GitHub.com (default, no change needed):

python3 main.py --org my-org

GHES:

python3 main.py --server-url https://github.example.com/api/v3 --org my-org --output report.md

GHES with enterprise and licenses:

python3 main.py --server-url https://github.example.com/api/v3 --enterprise my-enterprise --licenses 100 --output report.md

Testing

All tests pass successfully:

  • 4 new GHES-specific unit tests (test_ghes_support.py)
  • 3 existing max coverage algorithm tests continue to pass
  • Backward compatibility verified

Fixes #[issue_number]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: python3 -m unittest discover -s tests -v (http block)
    • Triggering command: python3 -m unittest discover -s tests -p test_*.py -v (http block)
  • https://api.github.com/orgs/thez-org/repos
    • Triggering command: python3 -m unittest discover -s tests -v (http block)
    • Triggering command: python3 -m unittest discover -s tests -p test_*.py -v (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for GHES?</issue_title>
<issue_description>Would need some changes:

ex: https://docs.github.com/en/enterprise-server@3.17/graphql/guides/forming-calls-with-graphql#the-graphql-endpoint

  • Accept user input for server url</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #6

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 4 commits October 8, 2025 18:31
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for GitHub Enterprise Server integration Add support for GitHub Enterprise Server (GHES) Oct 8, 2025
Copilot AI requested a review from felickz October 8, 2025 18:38
Copilot finished work on behalf of felickz October 8, 2025 18:38
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for GHES?

2 participants