lerna / lerna-changelog

:book: PR-based changelog generator with monorepo support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`lerna-changelog` making a request to github api for each PR

issammani opened this issue · comments

We have been using lerna-changelog internally at work to keep our changelog up to date. What we have noticed lately is that the github api rate limit is being exceeded.

Some metrics:

  • Github API rate limit: 5000 api calls
  • Number of PRs: ~300 PRs
  • Number of API calls lerna-changelog makes per run: ~500 api calls

If we run the changelog generation process more than 9 times within an hour we exceed the limit. This is due to the fact, that the code is making an api call (fetch) for each PR.

private async downloadIssueData(commitInfos: CommitInfo[]) {
progressBar.init("Downloading issue information…", commitInfos.length);
await pMap(
commitInfos,
async (commitInfo: CommitInfo) => {
if (commitInfo.issueNumber) {
commitInfo.githubIssue = await this.github.getIssueData(this.config.repo, commitInfo.issueNumber);
}
progressBar.tick();
},
{ concurrency: 5 }
);
progressBar.terminate();
}

I couldn't find anything related to this in the docs. Is this the expected behaviour ?

this is the expected behavior, but it should use an on-disk HTTP cache and AFAIK cache hits don't count towards that API request limit.

an alternative might be to use the GraphQL API of GitHub, but that needs further investigation.