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() { ...@@ -17,7 +17,7 @@ async function main() {
try { try {
const { data: issues } = await octokit.rest.search.issuesAndPullRequests({ const { data: issues } = await octokit.rest.search.issuesAndPullRequests({
order: 'desc', order: 'desc',
per_page: 50, per_page: 25,
q: `repo:${owner}/${repo} is:issue is:open`, q: `repo:${owner}/${repo} is:issue is:open`,
}) })
...@@ -25,29 +25,33 @@ async function main() { ...@@ -25,29 +25,33 @@ async function main() {
(issue) => issue.body && issue.body.includes(`${version}`) (issue) => issue.body && issue.body.includes(`${version}`)
) )
const blocks = BlockCollection([ if (filteredIssues.length > 0) {
Section({ const blocks = BlockCollection([
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}._`, 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({ Divider(),
text: filteredIssues Section({
.map( text: filteredIssues
(issue, i) => .map(
`${i + 1}. <${issue.html_url}|#${issue.number}>: ${issue.title}` (issue, i) =>
) `${i + 1}. <${issue.html_url}|#${issue.number}>: ${issue.title}`
.join('\n'), )
}), .join('\n'),
]) }),
])
await slackClient.chat.postMessage({
blocks, await slackClient.chat.postMessage({
channel: '#next-info', blocks,
icon_emoji: ':github:', channel: '#next-info',
username: 'GitHub Notifier', icon_emoji: ':github:',
}) username: 'GitHub Notifier',
})
info(`Posted to Slack!`)
info(`Posted to Slack!`)
} else {
info(`No issues found for ${version}.`)
}
} catch (error) { } catch (error) {
setFailed(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