Skip to content

API rate limit exceeded #422

@wookayin

Description

@wookayin

First of all, congratulations and thanks for the great work being done on Github integration #363.

Describe the bug

On a large repository where there are a lot of commits, API rate limit is always so I can't generate the release note.

My understanding from #363 is that ALL of the commits in the repository is fetched, so in this way every git cliff attempt will be turned down by an excessive usage of APIs. Even if # of the commits to be contained in a release note is small (e.g. between two minor releases), it's not like the PR information about each commit is fetched but it's like git-cliff is trying to fetch everything.

Also, it's not clear how many requests are (unawarely) being made through git cliff. Can we make it a bit more verbose?

To reproduce

neovim/neovim has ~28k commits as of today.

git clone https://github.com/neovim/neovim && cd neovim

Apply the patch:

diff --git scripts/cliff.toml scripts/cliff.toml
index 3fc10e5d1..bc1f22c56 100644
--- scripts/cliff.toml
+++ scripts/cliff.toml
@@ -1,5 +1,9 @@
 # configuration file for git-cliff (0.1.0)
 
+[remote.github]
+owner = "neovim"
+repo = "neovim"
+
 [changelog]
 # changelog header
 header = """
@@ -18,12 +22,12 @@ body = """
     ### {{ group | upper_first }}
     {% for commit in commits%}\
         {% if not commit.scope %}\
-            - {{ commit.message | upper_first }}
+            - {{ commit.message | upper_first }} (#{{ commit.github.pr_number }})
         {% endif %}\
     {% endfor %}\
     {% for group, commits in commits | group_by(attribute="scope") %}\
         {% for commit in commits %}\
-            - **{{commit.scope}}**: {{ commit.message | upper_first }}
+            - **{{commit.scope}}**: {{ commit.message | upper_first }} (#{{ commit.github.pr_number }})
         {% endfor %}\
     {% endfor %}
 {% endfor %}\n

Then run:

git cliff --config scripts/cliff.toml v0.9.4..v0.9.5  --github-token <TOKEN>

Expected behavior

No errors.

Screenshots / Logs

Bunch of API limit errors (possibly one log is per page request):

▹▹▸▹▹ Retrieving data from GitHub... (neovim/neovim)

 ERROR git_cliff_core::github    > Request error: {
  "documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits",
  "message": "You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID D7CB:1218:1333433:289A206:65902213."
}

Software information

Additional Information

If I may suggest, fetching PR information for only the relevant commits, e.g., via https://api.github.com/repos/neovim/neovim/commits/COMMIT/pulls, would be an alternative, efficient way.

https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingintegrationRelated to remote integration

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions