Unverified Commit 7421a868 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[ci] Remove the popular workflow and its action (#97753)

The `popular` workflow posted weekly Slack digests of the most-reacted
issues, PRs, and feature requests. That reporting is now handled by the
Next.js maintainer agent, so this PR deletes the workflow along with its
backing `next-repo-actions` action (sources and checked-in ncc bundles),
which had no other consumer, and regenerates the `.github` lockfile
without the action's dependencies.
Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
parent 33a5d542
This diff is collapsed.
import { getExecOutput } from '@actions/exec'
import { setFailed } from '@actions/core'
// format date to <month|short> <day|numeric>, <year|numeric>
export function formattedDate(createdAt) {
const date = new Date(createdAt)
return date.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})
}
// Get the date 90 days ago (YYYY-MM-DD)
export function ninetyDaysAgo() {
const date = new Date()
date.setDate(date.getDate() - 90)
return date.toISOString().split('T')[0]
}
{
"private": true,
"description": "A variety of functions to help with triaging issues, PRs, and feature requests in the Next.js repo.",
"scripts": {
"build-issues": "ncc build src/popular-issues.mjs -m -o dist/issues --license licenses.txt",
"build-prs": "ncc build src/popular-prs.ts -m -o dist/prs --license licenses.txt",
"build-feature-requests": "ncc build src/popular-feature-requests.mjs -m -o dist/feature-requests --license licenses.txt"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "6.0.0",
"@ai-sdk/openai": "^0.0.67",
"@slack/web-api": "^7.6.0",
"ai": "^3.4.14",
"slack-block-builder": "^2.8.0",
"zod": "^3.25.76"
},
"devDependencies": {
"@vercel/ncc": "0.38.4"
}
}
// @ts-check
import { context, getOctokit } from '@actions/github'
import { info, setFailed } from '@actions/core'
import { WebClient } from '@slack/web-api'
import { formattedDate, ninetyDaysAgo } from '../lib/util.mjs'
/**
* @typedef Search
* @property {Node[]} nodes
*
* @typedef Node
* @property {string} createdAt
* @property {number} number
* @property {string} title
* @property {number} upvoteCount
* @property {string} url
*
* @typedef {{ search: Search }} GraphQLResponse
*
* @typedef Item
* @property {string} created_at
* @property {string} html_url
* @property {number} number
* @property {string} title
* @property {number} upvoteCount
*/
/** @param {Item[]} items */
function generateBlocks(items) {
const blocks = [
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*A list of the top 15 feature requests sorted by upvotes over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-actions/src/popular-feature-requests.mjs|action> will run every Monday at 10AM UTC (6AM EST)._',
},
},
{
type: 'divider',
},
]
let text = ''
items.forEach((item, i) => {
text += `${i + 1}. [<${item.html_url}|#${item.number}>, ↑ ${
item.upvoteCount
}, ${formattedDate(item.created_at)}]: ${item.title}\n`
})
blocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: text,
},
})
return blocks
}
async function run() {
try {
if (!process.env.GITHUB_TOKEN) throw new TypeError('GITHUB_TOKEN not set')
if (!process.env.SLACK_TOKEN) throw new TypeError('SLACK_TOKEN not set')
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)
const { owner, repo } = context.repo
/** @type {GraphQLResponse} */
const { search } = await octoClient.graphql(`{
search(
type: DISCUSSION
first: 15
query: "repo:${owner}/${repo} is:open category:Ideas sort:top created:>=${ninetyDaysAgo()}"
) {
nodes {
... on Discussion {
number
title
url
upvoteCount
createdAt
}
}
}
}`)
const items = search.nodes.map((node) => ({
title: node.title,
number: node.number,
html_url: node.url,
created_at: formattedDate(node.createdAt),
upvoteCount: node.upvoteCount,
}))
await slackClient.chat.postMessage({
blocks: generateBlocks(items),
channel: '#coord-next-triage',
icon_emoji: ':github:',
username: 'GitHub Notifier',
})
info(`Posted to Slack!`)
} catch (error) {
setFailed(error)
}
}
run()
// @ts-check
import { context, getOctokit } from '@actions/github'
import { info, setFailed } from '@actions/core'
import { WebClient } from '@slack/web-api'
import { formattedDate, ninetyDaysAgo } from '../lib/util.mjs'
function generateBlocks(issues) {
const blocks = [
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*A list of the top 15 issues sorted by the most reactions over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-actions/src/popular-issues.mjs|action> will run every Monday at 10AM UTC (6AM EST). These issues are automatically synced to Linear._',
},
},
{
type: 'divider',
},
]
let text = ''
issues.forEach((issue, i) => {
text += `${i + 1}. [<${issue.html_url}|#${issue.number}>, ${
issue.reactions.total_count
} reactions, ${formattedDate(issue.created_at)}]: ${issue.title}\n`
})
blocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: text,
},
})
return blocks
}
async function run() {
try {
if (!process.env.GITHUB_TOKEN) throw new TypeError('GITHUB_TOKEN not set')
if (!process.env.SLACK_TOKEN) throw new TypeError('SLACK_TOKEN not set')
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)
const { owner, repo } = context.repo
const { data } = await octoClient.rest.search.issuesAndPullRequests({
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} is:issue is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions',
})
if (data.items.length > 0) {
data.items.forEach(async (item) => {
const labelType = item.labels.some(
(label) => label.name === 'Turbopack'
)
? 'turbopack'
: 'next'
const syncLabel = `linear: ${labelType}`
await octoClient.rest.issues.addLabels({
owner,
repo,
issue_number: item.number,
labels: [syncLabel],
})
})
await slackClient.chat.postMessage({
blocks: generateBlocks(data.items),
channel: '#coord-next-triage',
icon_emoji: ':github:',
username: 'GitHub Notifier',
})
info(`Posted to Slack!`)
} else {
info(`No popular issues`)
}
} catch (error) {
setFailed(error)
}
}
run()
// @ts-check
import { setFailed, info } from '@actions/core'
import { context, getOctokit } from '@actions/github'
import { WebClient } from '@slack/web-api'
import { BlockCollection, Divider, Section } from 'slack-block-builder'
import { formattedDate, ninetyDaysAgo } from '../lib/util.mjs'
async function run() {
try {
if (!process.env.GITHUB_TOKEN) throw new TypeError('GITHUB_TOKEN not set')
if (!process.env.SLACK_TOKEN) throw new TypeError('SLACK_TOKEN not set')
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)
const { owner, repo } = context.repo
const { data: prs } = await octoClient.rest.search.issuesAndPullRequests({
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} -is:draft is:pr is:open created:>=${ninetyDaysAgo()}`,
sort: 'reactions',
})
if (prs.items.length > 0) {
let text = ''
let count = 0
prs.items.forEach((pr, i) => {
if (pr.reactions) {
if (pr.reactions.total_count > 1) {
text += `${i + 1}. [<${pr.html_url}|#${pr.number}>, ${
pr.reactions.total_count
} reactions, ${formattedDate(pr.created_at)}]: ${pr.title}\n`
count++
}
}
})
const blocks = BlockCollection([
Section({
text: `*A list of the top ${count} PRs sorted by the most reactions (> 1) over the last 90 days.*\n_Note: This :github2: <https://github.com/vercel/next.js/blob/canary/.github/workflows/popular.yml|workflow> → <https://github.com/vercel/next.js/blob/canary/.github/actions/next-repo-actions/src/popular-prs.ts|action> will run every Monday at 10AM UTC (6AM EST)._`,
}),
Divider(),
Section({
text,
}),
])
await slackClient.chat.postMessage({
blocks,
channel: '#coord-next-triage',
icon_emoji: ':github:',
username: 'GitHub Notifier',
})
info(`Posted to Slack!`)
} else {
info(`No popular PRs.`)
}
} catch (error) {
setFailed(error)
}
}
run()
{
"compilerOptions": {
"target": "es2015",
"moduleResolution": "node"
}
}
This diff is collapsed.
name: Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days
on:
schedule:
- cron: '0 10 * * 1' # Every Monday at 10AM UTC (6AM EST)
workflow_dispatch:
jobs:
run:
if: github.repository_owner == 'vercel'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
package-manager-cache: false
- name: Setup corepack
run: |
npm i -g corepack@0.31
corepack enable
- name: 'Issues: Send notification to Slack'
run: node ./.github/actions/next-repo-actions/dist/issues/index.mjs
continue-on-error: true
- name: 'PRs: Send notification to Slack'
run: node ./.github/actions/next-repo-actions/dist/prs/index.js
continue-on-error: true
- name: 'Feature requests: Send notification to Slack'
run: node ./.github/actions/next-repo-actions/dist/feature-requests/index.mjs
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
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