You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simply trying to access a diff of a PR, but it always return 404(works only for public repos).
All other APIs that require authentication work (List pull request for example).
Only when trying to access the diff URL,it doesn't, and return 404.
It is accessible using the browser under authenticated session, but the API - 404.
Any idea?
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method === 'POST') {
const payload = req.body;
if (payload.action === 'opened' && payload.pull_request) { // Process only 'opened' PR events
const diffUrl = prData.diff_url;
console.log(`New PR opened: #${prNumber} in ${repoOwner} ${repoName}`);
console.log(`Diff URL: ${diffUrl}`);
try {
const diffResponse = await octokit.request({
method: 'GET',
url: diffUrl,
headers: {
'Accept': 'application/vnd.github.v3.diff' // Request raw diff
}
});
}
Versions
"octokit": "^4.1.2",
Relevant log output
curl -H "Authorization: token github_pat_my_token_here" https://github.com/theunreal/codesight/pull/11.diff
Not Found%
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
Not sure what you mean, but the headers are mentioned in the script, excluded the token (used in octokit init)
Anyway, I think it's an issue with github API, or there is another way to access file diff that I don't know about. But I couldn't find a way to access the diff_url
What happened?
Simply trying to access a diff of a PR, but it always return 404(works only for public repos).
All other APIs that require authentication work (List pull request for example).
Only when trying to access the diff URL,it doesn't, and return 404.
It is accessible using the browser under authenticated session, but the API - 404.
Any idea?
Versions
"octokit": "^4.1.2",
Relevant log output
curl -H "Authorization: token github_pat_my_token_here" https://github.com/theunreal/codesight/pull/11.diff Not Found%
Code of Conduct
The text was updated successfully, but these errors were encountered: