Add support for GitHub Enterprise Server (GHES) #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds support for GitHub Enterprise Server (GHES) by introducing a new
--server-urlparameter 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
--server-urlcommand-line argument with default valuehttps://api.github.comhttps://HOSTNAME/api/v3formatUpdated Functions
Updated all GitHub API functions in
github.pyto accept and use theserver_urlparameter:get_orgs_in_ent()- constructs GraphQL endpoint based on server URLget_ghas_status_for_repos()- uses server URL for REST API callsget_active_committers_in_last_90_days()- uses server URL for GraphQL callsprocess_organizations(),get_organizations(),add_active_committers()- pass server URL through call chainDocumentation
Testing
tests/test_ghes_support.py) to verify:Usage Examples
GitHub.com (default, no change needed):
GHES:
GHES with enterprise and licenses:
Testing
All tests pass successfully:
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/graphqlpython3 -m unittest discover -s tests -v(http block)python3 -m unittest discover -s tests -p test_*.py -v(http block)https://api.github.com/orgs/thez-org/repospython3 -m unittest discover -s tests -v(http block)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
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.