Issues reading diff from within action #25400
-
Hello! I’m trying to obtain a diff from my action on a private repo and I’m using this piece of code here: https://github.com/actions/github-script#download-data-from-a-url It looks a lot like the example:
It’s not working, unfortunately. For some reason the token is not authenticating and I’m receiving a 404 when making that request:
What can I fix to get the full diff? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @renata-slalom, The error is due to the repository is private, it’s failed to request(GET) from ‘https://github.com/myrepo/pull/123.diff’ directly.
Or directly use below command to get diff:
Thanks. |
Beta Was this translation helpful? Give feedback.
-
This is my bad! The example shouldn’t be in the github-script README as-is. @weide-zhou is correct that the right way of getting this is via the GitHub API with the diff content type in the “Accept” header. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to do this using github.request() ? I notice that when I set the headers, the underlying REST client does not set the correct headers. |
Beta Was this translation helpful? Give feedback.
This is my bad! The example shouldn’t be in the github-script README as-is. @weide-zhou is correct that the right way of getting this is via the GitHub API with the diff content type in the “Accept” header.