Bug Description
The get_diff_of_pull_request function in src/git_bob/_github_utilities.py isn't working for private GitHub repositories. It fetches pull request diffs just fine when the repository is public, but as soon as it's private, it fails.
Steps to Reproduce
- Make sure
git-bob is set up with a GitHub API key that has access to a private repository.
- Open a pull request in that private repository.
- Try to use any
git-bob feature that relies on get_diff_of_pull_request (e.g., the commenting or reviewing features for pull requests in _ai_github_utilities.py).
Expected Behavior
We expect get_diff_of_pull_request to retrieve diffs from both public and private repositories without issue, assuming the authenticated PyGithub instance has the right permissions.
Actual Behavior
When trying to get a pull request diff from a private repository, the requests.get() call to pull_request.diff_url returns Error: 404 Not Found, which means the diff content can't be retrieved.
Root Cause
Maybe the problem is that the requests.get() call on line _github_utilities.py:622 doesn't include the necessary headers. See below link for more.
Additional Links
https://github.com/orgs/community/discussions/24460#discussioncomment-3244157
git-bob comment
Bug Description
The
get_diff_of_pull_requestfunction insrc/git_bob/_github_utilities.pyisn't working for private GitHub repositories. It fetches pull request diffs just fine when the repository is public, but as soon as it's private, it fails.Steps to Reproduce
git-bobis set up with a GitHub API key that has access to a private repository.git-bobfeature that relies onget_diff_of_pull_request(e.g., the commenting or reviewing features for pull requests in_ai_github_utilities.py).Expected Behavior
We expect
get_diff_of_pull_requestto retrieve diffs from both public and private repositories without issue, assuming the authenticated PyGithub instance has the right permissions.Actual Behavior
When trying to get a pull request diff from a private repository, the
requests.get()call topull_request.diff_urlreturnsError: 404 Not Found, which means the diff content can't be retrieved.Root Cause
Maybe the problem is that the
requests.get()call on line_github_utilities.py:622doesn't include the necessary headers. See below link for more.Additional Links
https://github.com/orgs/community/discussions/24460#discussioncomment-3244157
git-bob comment