Skip to content

Fix pull request diff retrieval for private repositories using GitHub's REST API - #745

Merged
haesleinhuepf merged 2 commits into
mainfrom
git-bob-mod-tMa40hpcJ3
Jun 23, 2025
Merged

Fix pull request diff retrieval for private repositories using GitHub's REST API#745
haesleinhuepf merged 2 commits into
mainfrom
git-bob-mod-tMa40hpcJ3

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This message was generated by git-bob (version: 0.24.0, model: claude-3-5-sonnet-20241022, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

I modified the get_diff_of_pull_request function to properly handle diffs from private repositories by using GitHub's REST API endpoint with the correct Accept header. Instead of using the diff_url property which returns a web UI URL, the function now constructs the proper API endpoint (https://api.github.com/repos/{owner}/{repo}/pulls/{number}) and includes both the Authorization token and the required Accept header (application/vnd.github.v3.diff) to specifically request diff content. This change ensures that the function can retrieve diffs from both public and private repositories when properly authenticated.

  • src/git_bob/_github_utilities.py Updated pull request diff retrieval to use GitHub's REST API endpoint with proper Accept header for private repository access.

closes #726

github-actions Bot and others added 2 commits June 23, 2025 06:30
…oint with proper Accept header for accessing diffs from private repositories.
@codecov

codecov Bot commented Jun 23, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.05%. Comparing base (c4145ae) to head (a2f434b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #745   +/-   ##
=======================================
  Coverage   59.05%   59.05%           
=======================================
  Files          14       14           
  Lines        1893     1893           
=======================================
  Hits         1118     1118           
  Misses        775      775           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haesleinhuepf
haesleinhuepf merged commit 2293d8a into main Jun 23, 2025
4 checks passed
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.

Bug: get_diff_of_pull_request fails for private repositories

1 participant