Skip to content

Commit

Permalink
docs(github-workflow): dynamically create pr list (> 1 +1 reaction)
Browse files Browse the repository at this point in the history
  • Loading branch information
samcx committed Feb 12, 2024
1 parent a3f4c35 commit b5c2a26
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
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

0 comments on commit b5c2a26

Please sign in to comment.