Skip to content
New issue

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

chore(github-workflow): dynamically create pr list (> 1 +1 reaction) #61963

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/next-repo-info/dist/prs/index.mjs

Large diffs are not rendered by default.

28 changes: 17 additions & 11 deletions .github/actions/next-repo-info/src/popular-prs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@ import { setFailed, info } from '@actions/core'
import { WebClient } from '@slack/web-api'

function generateBlocks(prs) {
let text = ''
let count = 0

const blocks = [
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*A list of the top 15 PRs sorted by most :+1: reactions over the last 90 days.*\n_Note: This :github2: workflow will run every Monday at 1PM UTC (9AM EST)._',
},
},
{
type: 'divider',
},
]

let text = ''
prs.forEach((pr, i) => {
text += `${i + 1}. [<${pr.html_url}|#${pr.number}>, :+1: ${
pr.reactions['+1']
}]: ${pr.title}\n`
if (pr.reactions['+1'] > 1) {
text += `${i + 1}. [<${pr.html_url}|#${pr.number}>, :+1: ${
pr.reactions['+1']
}]: ${pr.title}\n`
count++
}
})

blocks.unshift({
type: 'section',
text: {
type: 'mrkdwn',
text: `*A list of the top ${count} PRs sorted by most :+1: reactions (> 1) over the last 90 days.*\n_Note: This :github2: workflow will run every Monday at 1PM UTC (9AM EST)._`,
},
})

blocks.push({
Expand Down