I can't find how to programmatically retrieve an entire PR diff from the API.
I'm aware of
but I'm specifcally interested in private repositories, and this url doesn't seem to accept tokens in the "Authorization" header. Using cookies is not an option in this case unfortunately.
Solved! Solved! Go to Solution.
I'm just going to bump this topic - I've been trying to figure out how to pull a PR diff from a github app, and it doesn't seem to be possible? I would have thought looking at the contents of a PR would have been a super common use case, so I'm pretty baffled here.
You have to pass a custom `Accept` header to request a different media format.
$ curl -i --header "Accept: application/vnd.github.v3.diff" https://api.github.com/repos/gr2m/sandbox/pulls/7 HTTP/1.1 200 OK Date: Sat, 02 Mar 2019 22:28:15 GMT Content-Type: application/vnd.github.v3.diff; charset=utf-8 Content-Length: 172 Server: GitHub.com Status: 200 OK X-RateLimit-Limit: 60 X-RateLimit-Remaining: 58 X-RateLimit-Reset: 1551569262 Cache-Control: public, max-age=60, s-maxage=60 Vary: Accept ETag: "89a4add058d68717026fe382008df964" Last-Modified: Wed, 13 Feb 2019 17:03:03 GMT X-GitHub-Media-Type: github.v3; param=diff Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type Access-Control-Allow-Origin: * Strict-Transport-Security: max-age=31536000; includeSubdomains; preload X-Frame-Options: deny X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin Content-Security-Policy: default-src 'none' Vary: Accept-Encoding X-GitHub-Request-Id: D83C:7D6D:692F58:8052B4:5C7B037F diff --git a/README.md b/README.md index 50561f3..fcc4164 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # sandbox just playing around don’t mind me. + +test
You can request `Accept: application/vnd.github.v3.patch`, too.
It’s mentioned in the docs: https://developer.github.com/v3/pulls/#response-1
> Accept: application/vnd.github.v3.patch