devmatteini / dra

A command line tool to download release assets from GitHub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support using GITHUB_TOKEN

orhun opened this issue · comments

Hey!
While I was working on #5 I got the following error a bunch of times:

Error fetching latest release: https://api.github.com/repos/orhun/menyoki/releases/tags/v1.0.0: status code 403

This is due to GitHub rate-limiting unauthorized requests, see: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting

I solved this by generating a new personal access token and using basic HTTP auth for GET requests internally in dra. (i.e. I set a auth header for ureq::get calls)

So I'd like to propose a change about:

  • set "Authorization" header for GET requests if GITHUB_TOKEN is defined as an environment variable.

I also thought about adding a new argument such as --github-token but I'm not a big proponent of exposing secrets to the command line like that. Either way, let me know what you think and I'm happy to help implement this 🐻

Hi!
Yes. I was thinking about something like this, and currently working on it.
This would also allow to download assets from private repository which was my goal :)

I'll update this issue when it will be implemented

A quick update: I pushed the changes to main, and will be releasing a new version 0.2.2 in a couple of minutes :)