Skip to content

feat: display Github REST API rate limit information#1680

Open
silentJET85 wants to merge 2 commits intowimpysworld:mainfrom
silentJET85:ratelimit-info
Open

feat: display Github REST API rate limit information#1680
silentJET85 wants to merge 2 commits intowimpysworld:mainfrom
silentJET85:ratelimit-info

Conversation

@silentJET85
Copy link
Contributor

closes #1630

This PR adds the ability for deb-get to display information about the Github rate limit whenever you install or update an app that installs from Github.

It will show how many requests you have used, how many are remaining, and how many you have total.
It will also show a reminder if you haven't set a DEBGET_TOKEN. If your DEBGET_TOKEN is invalid, it will show a message for that too.

Here are some examples of output in different scenarios:

Trying to install when your DEBGET_TOKEN is invalid:

jet@debian13:~/shared-folder$ ./deb-get install micro
  [+] Updating /var/cache/deb-get/micro.json_extract
  HTTP/1.1 401 Unauthorized
  [*] WARNING! The DEBGET_TOKEN is invalid or expired.
  [*] WARNING! Cached file /var/cache/deb-get/micro.json_extract is empty or missing.
/var/cache/deb-get/: Is a directory
  [!] ERROR! Failed to download . Deleting /var/cache/deb-get/...

Trying to install when the rate limit has been reached:

jet@debian13:~/shared-folder$ ./deb-get install micro
  [+] Updating /var/cache/deb-get/micro.json_extract
  [!] DEBGET_TOKEN is not set. To increase your rate limit, create a Github Personal Access Token and put it in the DEBGET_TOKEN environment variable.
  [*] WARNING! Github API rate limit has been reached. You may experience problems downloading from Github.
  [+] Github API: 60 request(s) used out of 60. 0 remaining.
  [+] Github API: Rate limit resets in 6 minutes, 32 seconds.
API rate limit exceeded for 00.000.00.000. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting
  [*] WARNING! Updating /var/cache/deb-get/micro.json_extract exceeded GitHub API limits. Deleting it.
  [*] WARNING! Cached file /var/cache/deb-get/micro.json_extract is empty or missing.
/var/cache/deb-get/: Is a directory
  [!] ERROR! Failed to download . Deleting /var/cache/deb-get/...

Installing without a token set:

jet@debian13:~/shared-folder$ ./deb-get install micro
  [+] Updating /var/cache/deb-get/micro.json_extract
  [!] DEBGET_TOKEN is not set. To increase your rate limit, create a Github Personal Access Token and put it in the DEBGET_TOKEN environment variable.
  [+] Github API: 9 request(s) used out of 60. 51 remaining.
  [+] Github API: Rate limit resets in 13 minutes, 36 seconds.
--2026-02-10 20:52:48--  https://github.com/micro-editor/micro/releases/download/v2.0.13/micro-2.0.13-amd64.deb
Resolving github.com (github.com)... 140.82.112.3
Connecting to github.com (github.com)|140.82.112.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://release-assets.githubusercontent.com/github-production-release-asset/53632140/433b20ff-87b9-4f11-8899-791b5ad176ea?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-02-11T03%3A47%3A17Z&rscd=attachment%3B+filename%3Dmicro-2.0.13-amd64.deb&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-02-11T02%3A46%3A55Z&ske=2026-02-11T03%3A47%3A17Z&sks=b&skv=2018-11-09&sig=r1IEfAlLNtzg4yg0BM14YsPjSc2RwW0sOXWDqNsy8xA%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc3MDc3ODY5NiwibmJmIjoxNzcwNzc4Mzk2LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.7gIuIOW5Wpcf_TARS8AHobMvEOO8GeBO1gm1387aMk8&response-content-disposition=attachment%3B%20filename%3Dmicro-2.0.13-amd64.deb&response-content-type=application%2Foctet-stream [following]
--2026-02-10 20:52:48--  https://release-assets.githubusercontent.com/github-production-release-asset/53632140/433b20ff-87b9-4f11-8899-791b5ad176ea?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-02-11T03%3A47%3A17Z&rscd=attachment%3B+filename%3Dmicro-2.0.13-amd64.deb&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-02-11T02%3A46%3A55Z&ske=2026-02-11T03%3A47%3A17Z&sks=b&skv=2018-11-09&sig=r1IEfAlLNtzg4yg0BM14YsPjSc2RwW0sOXWDqNsy8xA%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc3MDc3ODY5NiwibmJmIjoxNzcwNzc4Mzk2LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.7gIuIOW5Wpcf_TARS8AHobMvEOO8GeBO1gm1387aMk8&response-content-disposition=attachment%3B%20filename%3Dmicro-2.0.13-amd64.deb&response-content-type=application%2Foctet-stream
Resolving release-assets.githubusercontent.com (release-assets.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.109.133, ...
Connecting to release-assets.githubusercontent.com (release-assets.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4795244 (4.6M) [application/octet-stream]
Saving to: ‘/var/cache/deb-get/micro-2.0.13-amd64.deb’

/var/cache/deb-get/micro-2.0.13-amd64.deb       100%[====================================================================================================>]   4.57M  3.77MB/s    in 1.2s

2026-02-10 20:52:50 (3.77 MB/s) - ‘/var/cache/deb-get/micro-2.0.13-amd64.deb’ saved [4795244/4795244]

Selecting previously unselected package xclip.
(Reading database ... 216455 files and directories currently installed.)
Preparing to unpack .../xclip_0.13-4_amd64.deb ...
Unpacking xclip (0.13-4) ...
Selecting previously unselected package micro.
Preparing to unpack .../deb-get/micro-2.0.13-amd64.deb ...
Unpacking micro (2.0.13) ...
Setting up micro (2.0.13) ...
Setting up xclip (0.13-4) ...
Processing triggers for man-db (2.13.1-1) ...

Installing with a token:

jet@debian13:~/shared-folder$ ./deb-get install micro
  [+] Updating /var/cache/deb-get/micro.json_extract
  [+] Github API: 1 request(s) used out of 5000. 4999 remaining.
  [+] Github API: Rate limit resets in 60 minutes, 27 seconds.
--2026-02-10 20:54:37--  https://github.com/micro-editor/micro/releases/download/v2.0.13/micro-2.0.13-amd64.deb
Resolving github.com (github.com)... 140.82.114.4
Connecting to github.com (github.com)|140.82.114.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://release-assets.githubusercontent.com/github-production-release-asset/53632140/433b20ff-87b9-4f11-8899-791b5ad176ea?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-02-11T03%3A51%3A47Z&rscd=attachment%3B+filename%3Dmicro-2.0.13-amd64.deb&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-02-11T02%3A51%3A15Z&ske=2026-02-11T03%3A51%3A47Z&sks=b&skv=2018-11-09&sig=UAicBIbIjm8KcH0rXACl94TBZugA0oAjI4Vmm9npPuU%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc3MDc3ODgwNiwibmJmIjoxNzcwNzc4NTA2LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.3EGPhxzWoL3Of3a91KSpp_BL_zd1Av8lez7EaMtZs8c&response-content-disposition=attachment%3B%20filename%3Dmicro-2.0.13-amd64.deb&response-content-type=application%2Foctet-stream [following]
--2026-02-10 20:54:38--  https://release-assets.githubusercontent.com/github-production-release-asset/53632140/433b20ff-87b9-4f11-8899-791b5ad176ea?sp=r&sv=2018-11-09&sr=b&spr=https&se=2026-02-11T03%3A51%3A47Z&rscd=attachment%3B+filename%3Dmicro-2.0.13-amd64.deb&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2026-02-11T02%3A51%3A15Z&ske=2026-02-11T03%3A51%3A47Z&sks=b&skv=2018-11-09&sig=UAicBIbIjm8KcH0rXACl94TBZugA0oAjI4Vmm9npPuU%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc3MDc3ODgwNiwibmJmIjoxNzcwNzc4NTA2LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.3EGPhxzWoL3Of3a91KSpp_BL_zd1Av8lez7EaMtZs8c&response-content-disposition=attachment%3B%20filename%3Dmicro-2.0.13-amd64.deb&response-content-type=application%2Foctet-stream
Resolving release-assets.githubusercontent.com (release-assets.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.109.133, ...
Connecting to release-assets.githubusercontent.com (release-assets.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4795244 (4.6M) [application/octet-stream]
Saving to: ‘/var/cache/deb-get/micro-2.0.13-amd64.deb’

/var/cache/deb-get/micro-2.0.13-amd64.deb       100%[====================================================================================================>]   4.57M  5.07MB/s    in 0.9s

2026-02-10 20:54:39 (5.07 MB/s) - ‘/var/cache/deb-get/micro-2.0.13-amd64.deb’ saved [4795244/4795244]

Selecting previously unselected package xclip.
(Reading database ... 216455 files and directories currently installed.)
Preparing to unpack .../xclip_0.13-4_amd64.deb ...
Unpacking xclip (0.13-4) ...
Selecting previously unselected package micro.
Preparing to unpack .../deb-get/micro-2.0.13-amd64.deb ...
Unpacking micro (2.0.13) ...
Setting up micro (2.0.13) ...
Setting up xclip (0.13-4) ...
Processing triggers for man-db (2.13.1-1) ...

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Small focused change (23 lines) improving GitHub API error handling and rate limit reporting. Adds better diagnostics for 401 errors and rate limit visibility. No destructive operations, no security风险

@silentJET85 silentJET85 marked this pull request as draft February 20, 2026 01:29
@silentJET85
Copy link
Contributor Author

silentJET85 commented Feb 20, 2026

I'm going to need to tweak this a bit more to work properly with the jq that was added in #1740.
EDIT: Done.

@silentJET85 silentJET85 marked this pull request as ready for review February 23, 2026 01:21
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 4/5

  • Running as root can hit a bash: : command not found error when ELEVATE is empty, so headers aren’t captured and the rate-limit logic fails in deb-get.
  • This is a moderate, configuration-dependent issue rather than a broad regression, so merge risk looks low overall.
  • Pay close attention to deb-get - guard empty ELEVATE to avoid breaking header capture and rate-limit handling.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="deb-get">

<violation number="1" location="deb-get:185">
P2: Quoting an empty ELEVATE in the process substitution causes `bash: : command not found` when running as root, so headers aren’t captured and rate-limit logic fails.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Improve error message for missing/invalid personal token in app

1 participant