We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the file, there are two issues that need to be fixed:
- // eslint-disable-next-line no-useless-catch - try { if (!process.env.GITHUB_TOKEN) { throw new Error('GITHUB_TOKEN environment variable is required'); } const allItems = []; let page = 1; const maxPerPage = 50; const getReqUrl = (PerPage: number, pageNo: number) => `https://api.github.com/search/code?q=filename:.asyncapi-tool&per_page=${PerPage}&page=${pageNo}`; const headers = { accept: 'application/vnd.github.text-match+json', authorization: `token ${process.env.GITHUB_TOKEN}` }; const result = await axios.get(getReqUrl(maxPerPage, page), { headers }); const totalResults = result.data.total_count; allItems.push(...result.data.items); while (allItems.length < totalResults) { page++; logger.info(`Fetching page: ${page}`); // pause for 1 second to avoid rate limiting await pause(1000); const nextPageData = await axios.get(getReqUrl(maxPerPage, page), { headers }); const { data } = nextPageData; allItems.push(...data.items); } - result.data.items.push(...allItems); + // Items from the first page are already in allItems, no need to append them again return result.data; - } catch (err) { - throw err; - }
This issue is related to the TypeScript migration in PR #3761.
Originally identified in: #3761 (comment)
Adding this as a task for issue #3764 as requested by @akshatnema.
The text was updated successfully, but these errors were encountered:
akshatnema
No branches or pull requests
Issue
In the file, there are two issues that need to be fixed:
Suggested fix
This issue is related to the TypeScript migration in PR #3761.
Originally identified in: #3761 (comment)
Adding this as a task for issue #3764 as requested by @akshatnema.
The text was updated successfully, but these errors were encountered: