Skip to content

Conversation

@SuyashJain17
Copy link

Description

  • This PR adds support for GitHub Enterprise API endpoints by making the GitHub API base URL configurable.
  • A new github_api_base_url option is introduced under the Keys configuration section, defaulting to the public GitHub API.
  • All hardcoded https://api.github.com references across the codebase have been replaced with calls to a centralized URL management utility.

This PR fixes #3277

Summary
This implementation addresses issue #3277 by:

  • Adding configurability – Users can now specify their GitHub Enterprise API URL via the github_api_base_url config option.
  • Centralizing URL management – All GitHub API URLs are constructed through a single utility module.
  • Maintaining backward compatibility – The default value remains https://api.github.com, so existing installations work without any changes.
  • Comprehensive coverage – Updated all 17 files that previously contained hardcoded GitHub API URLs, including REST, GraphQL, rate-limit, and worker endpoints.

Notes for Reviewers

  • The change is fully backward compatible and opt-in for GitHub Enterprise users.
  • The centralized URL utility ensures consistent API URL construction across tasks, workers, and key validation.
  • Some GitHub Enterprise installations may require /api/v3 in the base URL; users can provide the full API root via configuration as needed.

Signed commits

  • Yes, I signed my commits.

@guptapratykshh
Copy link
Contributor

In your local branch, run: git rebase HEAD~1 --signoff
Force push your changes to overwrite the branch: git push --force-with-lease origin feat/github-enterprise-api-support

@SuyashJain17 SuyashJain17 force-pushed the feat/github-enterprise-api-support branch from 4fc1041 to b770a47 Compare January 16, 2026 17:59
Copy link
Contributor

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the enthusiasm with submitting a PR

I left some feedback in the review. I think this PR has potential as a more narrow refactoring to allow us to swap out the github base domain by using a function, but I think we may need to wait for a more comprehensive method of fetching the urls (i.e. from a database) before we are able to swap things in like that.

we are quite backlogged on PRs at the moment as well, so please be patient as we try and get through them all starting in mid-February

Comment on lines -43 to +44
"gitlab": "<gl_api_key>"
"gitlab": "<gl_api_key>",
"github_api_base_url": "https://api.github.com"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure this is the good long-term solution we are hoping for.

Whille this issue is specifically about githubs url, we also have our sights set on adding more platforms, and using the config in this way will require code changes for every url that is added - i.e. if someone wants to add a self hosted Forgejo instance).

Ultimately, we want to be able to dynamically find API keys for a particular platform and domain

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this PR acts as necessary stepping stone, by refactoring these hardcoded strings now, we isolate "Base URL" dependency into single utility functiongithub_api_url.py

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this PR begins to address, and may sufficiently for a proof of concept, fully address multitenancy, which is a long ambition of Augur. Handling Enterprise GitHub is a pretty huge step forward.

One question: @SuyashJain17 : Do we have an enterprise GitHub we can test this against, because I do not have such access.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t currently have access to a live GitHub Enterprise instance.
This was implemented against GitHub’s documented Enterprise API behavior (including /api/v3 and /graphql), and the change is fully opt-in.
If there’s an internal Enterprise test environment available, I’m happy to validate or adjust based on real responses.

@SuyashJain17 SuyashJain17 force-pushed the feat/github-enterprise-api-support branch 2 times, most recently from cd74789 to ae9f3e8 Compare January 16, 2026 19:44
Copy link
Contributor

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking better! Just a few more things to really clean things up

Given how much you change the except blocks (probably for pylint) I'd say move those into a new PR (or better yet, see if theres an issue you can document them in we need some nice good first issues for CHAOSScon attendees

Comment on lines -119 to +121
err = process_graphql_dict_response(logger,result,response_data)
err = process_dict_response(logger, result, response_data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesnt seem related to swapping out github API urls

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuyashJain17 : I have a theory about why this is here, but i would like to know from you.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s fair - this change is not strictly required for the base URL work.
It was done while refactoring the surrounding logic to reduce duplicated response-handling paths, but I agree it expands the scope.

Comment on lines -89 to +91
except:
except (json.JSONDecodeError, AttributeError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helpful change, but hesitant about including it in this PR? I guess its probably fine

import random

from typing import List
from sqlalchemy.orm import Session
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also my question.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it since it wasn’t being used in the current code path.
If it’s meant to support future logic or an implicit dependency, I’m happy to add it back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if youd like to clean it up. that may be better for a separate PR specifically dedicated to cleanup and formatting. Having too many unrelated changes in one PR makes it hard to be confident that things will still work afterwards

@sgoggins sgoggins requested a review from Ulincsys January 20, 2026 17:27
Copy link
Member

@sgoggins sgoggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need some of the questions answered by @SuyashJain17 to understand the state here, but I like the direction!

Comment on lines -43 to +44
"gitlab": "<gl_api_key>"
"gitlab": "<gl_api_key>",
"github_api_base_url": "https://api.github.com"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this PR begins to address, and may sufficiently for a proof of concept, fully address multitenancy, which is a long ambition of Augur. Handling Enterprise GitHub is a pretty huge step forward.

One question: @SuyashJain17 : Do we have an enterprise GitHub we can test this against, because I do not have such access.

Comment on lines -119 to +121
err = process_graphql_dict_response(logger,result,response_data)
err = process_dict_response(logger, result, response_data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuyashJain17 : I have a theory about why this is here, but i would like to know from you.

import random

from typing import List
from sqlalchemy.orm import Session
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also my question.

@sgoggins sgoggins self-assigned this Jan 20, 2026
@sgoggins sgoggins added admin Administrative/housekeeping/community tasks add-feature Adds new features labels Jan 20, 2026
@MoralCode MoralCode marked this pull request as draft January 21, 2026 17:43
@MoralCode MoralCode marked this pull request as ready for review January 21, 2026 17:44
Copy link
Contributor

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No code changes have been made since my prior comments so my prior request for changes stands. I'd be willing to merge this if it only swapped out the github domain everywhere we use it with a function call such that we COULD put an enterprise URL there in the future. I think the broader "support GHE properly" type fixes need to be done as part of my broader effort towards expanding platform support

I suspect i could find someone with GHE access to help validate too, but i dont think that it should block the merging of this if changed to match the above

@SuyashJain17
Copy link
Author

Thanks for clarifying ,
I understand now that you’re looking for a narrowly scoped refactor that only abstracts the GitHub base domain behind a function call, without any additional behavior or cleanup changes.

I’ll push an update that reverts the unrelated refactors and keeps this PR limited strictly to swapping api.github.com usage with a centralized accessor.

guptapratykshh and others added 12 commits January 22, 2026 00:17
… AttributeError on bare metal installs

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…nts and contributors

Signed-off-by: Shlok Gilda <gildashlok@hotmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…eter and skip the db stuff

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…or the merging functionality

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <17362949+MoralCode@users.noreply.github.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: pushpit kamboj <pushpitkamboj@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: iGufrankhan <gufrankhankab123@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
MoralCode and others added 20 commits January 22, 2026 00:17
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…throwing an exception

Assisted-by: GPT5 via cursor

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…ved.

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…tch them to re-emit celery exceptions.

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
…iases table

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <17362949+MoralCode@users.noreply.github.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Adrian Edwards <17362949+MoralCode@users.noreply.github.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Sean P. Goggins <outdoors@acm.org>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: guptapratykshh <pratykshgupta9999@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
@SuyashJain17 SuyashJain17 force-pushed the feat/github-enterprise-api-support branch 3 times, most recently from e3770d3 to 4fcf074 Compare January 21, 2026 20:28
Signed-off-by: Suyash Jain <suyashjain1707@gmail.com>
@SuyashJain17 SuyashJain17 force-pushed the feat/github-enterprise-api-support branch from fd0ae40 to 2a94523 Compare January 21, 2026 20:30
Signed-off-by: Suyash Jain <153724685+SuyashJain17@users.noreply.github.com>
@MoralCode MoralCode self-assigned this Jan 26, 2026
@MoralCode
Copy link
Contributor

Hello! Just wanted to check in to see if you were still interested in helping the maintainers merge this PR. We noticed it has been a little while since this last had activity, and are considering closing it or taking it over if it remains in its current state.

Please react to or reply to this to confirm your interest in the next 7 days or let us know if you are no longer interested in this so we can best prioritize everyone's contributions.

Thanks!

@MoralCode MoralCode added the stale Stuff that's abandoned or not making forward progress and may need taking over/closing label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-feature Adds new features admin Administrative/housekeeping/community tasks stale Stuff that's abandoned or not making forward progress and may need taking over/closing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to use Github Enterprise API for api key checks

8 participants