Unverified Commit 8f90c352 authored by Sam Ko's avatar Sam Ko Committed by GitHub

chore(github): reduce per_page to 25 for issues-by-version (#69974)

## Why?

We're running into the GitHub rate limit when querying for 50
`per_page`, so reducing to 25.

Also adding logic throw a `info(...)` message when no issues by <xyz>
version are found.
parent 1d94f6c7
......@@ -17,7 +17,7 @@ async function main() {
try {
const { data: issues } = await octokit.rest.search.issuesAndPullRequests({
order: 'desc',
per_page: 50,
per_page: 25,
q: `repo:${owner}/${repo} is:issue is:open`,
})
......@@ -25,29 +25,33 @@ async function main() {
(issue) => issue.body && issue.body.includes(`${version}`)
)
const blocks = BlockCollection([
Section({
text: `*A list of the most recently created, open issues that are on v${version}.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/issue_version.yml|workflow> queries the 50 most recent issues, then filters them to only include issues that mention v${version}._`,
}),
Divider(),
Section({
text: filteredIssues
.map(
(issue, i) =>
`${i + 1}. <${issue.html_url}|#${issue.number}>: ${issue.title}`
)
.join('\n'),
}),
])
await slackClient.chat.postMessage({
blocks,
channel: '#next-info',
icon_emoji: ':github:',
username: 'GitHub Notifier',
})
info(`Posted to Slack!`)
if (filteredIssues.length > 0) {
const blocks = BlockCollection([
Section({
text: `*A list of the most recently created, open issues that are on v${version}.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/issue_version.yml|workflow> queries the 50 most recent issues, then filters them to only include issues that mention v${version}._`,
}),
Divider(),
Section({
text: filteredIssues
.map(
(issue, i) =>
`${i + 1}. <${issue.html_url}|#${issue.number}>: ${issue.title}`
)
.join('\n'),
}),
])
await slackClient.chat.postMessage({
blocks,
channel: '#next-info',
icon_emoji: ':github:',
username: 'GitHub Notifier',
})
info(`Posted to Slack!`)
} else {
info(`No issues found for ${version}.`)
}
} catch (error) {
setFailed(error)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment