Download file attached to issue comment on private repo

Is there a way to download a file attached to an issue comment on a private repo via the API?

I found a staff comment on an issue indicating that the API doesn’t support that and tried downloading using the URL from the issue, which looks something like https://github.com/someowner/somerepo/files/123456/foo.txt but get a 404. I’m guessing that is because the API token is only for api.github.com? How can I download issue comment files programatically?

Thanks

If it is scoped to a private repo, then you’ll have to authenticate as a user that has access to that private repository to download the file. You can find information about various methods of authentication in our developer documentation.

Let us know if you have more questions.

Having the same trouble and wasn’t able to get a file attached my issue (also on a private github)
I have a 404 response whatever authentification I try (basic, UsernamePasswordCredentials).
Did you manage to get your file?

Thanks

Hello!!
Hitting the same problem here.
The file I am trying to download is like https://github.com/<username>/<repo>/files/<some_id>/<filename>
I am trying to download the files in github workflow actions - where I have access to GITHUB_TOKEN.

I kept getting 404 error as I tried different authentication methods as mentioned above.
Not being an expert here, but it appears these auth methods are for rest api?

I am wondering if anyone has a working solution.
Thanks!

Hello ,
I met the same issue, Could I know how to do it . Many Thanks