Skip to content

Commit

Permalink
Merge branch 'canary' into 01-12-Enable_windowHistorySupport_by_default
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Jan 12, 2024
2 parents ae659e1 + cc2bd0d commit 727292e
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 62,560 deletions.
31,277 changes: 0 additions & 31,277 deletions .github/actions/next-repo-info/dist-issues/index.mjs

This file was deleted.

31,258 changes: 0 additions & 31,258 deletions .github/actions/next-repo-info/dist-pr/index.mjs

This file was deleted.

17 changes: 17 additions & 0 deletions .github/actions/next-repo-info/dist/issues/index.mjs

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions .github/actions/next-repo-info/dist/prs/index.mjs

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions .github/actions/next-repo-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"private": true,
"description": "Notify Next.js team about pending PRs and popular issues",
"scripts": {
"build": "pnpm build-pr && pnpm build-issues",
"build-pr": "ncc build src/pr-approved.mjs -m -o dist-pr --license licenses.txt",
"build-issues": "ncc build src/popular-issues.mjs -m -o dist-issues --license licenses.txt"
"build-issues": "ncc build src/popular-issues.mjs -m -o dist/issues --license licenses.txt",
"build-prs": "ncc build src/pr-approved.mjs -m -o dist/prs --license licenses.txt"
},
"dependencies": {
"@actions/core": "^1.10.1",
Expand Down
38 changes: 25 additions & 13 deletions .github/actions/next-repo-info/src/popular-issues.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@ function getOneMonthAgoDate() {

function generateBlocks(issues) {
const blocks = [
{ type: 'section', text: { type: 'mrkdwn', text: '*Top 15 issues:*' } },
{ type: 'divider' },
]
issues.forEach((issue) => {
blocks.push({
{
type: 'section',
text: {
type: 'mrkdwn',
text: `• <${issue.html_url}|#${issue.number}>: ${issue.title}`,
text: 'A list of the top 15 issues sorted by most :+1: reactions over the last 30 days.*\n_Note: This :github: workflow will run every Monday at 1PM UTC (9AM EST)._',
},
})
},
{
type: 'divider',
},
]
let text = ''
issues.forEach((issue) => {
text += `• <${issue.html_url}|#${issue.number}>: ${issue.title}\n`
})
blocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: text,
},
})
return blocks
}
Expand All @@ -35,25 +45,27 @@ async function run() {
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)

const { owner, repo } = context.repo
const oneMonthAgo = getOneMonthAgoDate()

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:>=${oneMonthAgo} sort:reactions-+1-desc`,
q: `repo:${owner}/${repo} is:issue is:open created:>=${oneMonthAgo}`,
sort: 'reactions-+1',
})

if (data.items.length > 0) {
await slackClient.chat.postMessage({
blocks: generateBlocks(data.items),
channel: '#next-js-repo-udpates',
channel: '#next-js-repo-updates',
icon_emoji: ':github:',
username: 'GitHub',
username: 'GitHub Notifier',
})

info(`Posted to Slack!`)
} else {
info(`No popular issues`)
}
info(`No popular issues`)
} catch (error) {
setFailed(error)
}
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/next-repo-info/src/pr-approved.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ async function run() {
const slackClient = new WebClient(process.env.SLACK_TOKEN)

const { owner, repo } = context.repo
const prs = await octoClient.rest.search.issuesAndPullRequests({
const { data } = await octoClient.rest.search.issuesAndPullRequests({
q: `repo:${owner}/${repo}+is:pr+is:open+review:approved -is:draft`,
})

const pendingPRs = prs.data.total_count
const pendingPRs = data.total_count

if (pendingPRs) {
await slackClient.chat.postMessage({
channel: '#next-js-repo-udpates',
text: `Pending PRs for Next.js: There are <https://github.com/vercel/next.js/pulls?q=is%3Apr+is%3Aopen+review%3Aapproved+-is%3Adraft|${prs.data.items.length} PRs> awaiting merge.`,
username: 'GitHub',
channel: '#next-js-repo-updates',
icon_emoji: ':github:',
text: `Pending PRs for Next.js: There are <https://github.com/vercel/next.js/pulls?q=is%3Apr+is%3Aopen+review%3Aapproved+-is%3Adraft|${prs.data.items.length} PRs> awaiting merge.`,
username: 'Github Notifier',
})

info(`Posted to Slack: ${pendingPRs} pending PRs`)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/issue_popular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

jobs:
pr-approved-open:
popular-issues:
if: github.repository_owner == 'vercel'
runs-on: ubuntu-latest
steps:
Expand All @@ -16,7 +16,7 @@ jobs:
node-version: 18
- run: corepack enable
- name: 'Send notification to Slack'
run: node ./.github/actions/next-repo-info/dist-issues/index.mjs
run: node ./.github/actions/next-repo-info/dist/issues/index.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_approved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

jobs:
pr-approved-open:
pr-approved:
if: github.repository_owner == 'vercel'
runs-on: ubuntu-latest
steps:
Expand All @@ -16,7 +16,7 @@ jobs:
node-version: 18
- run: corepack enable
- name: 'Send notification to Slack'
run: node ./.github/actions/next-repo-info/dist-pr/index.mjs
run: node ./.github/actions/next-repo-info/dist/prs/index.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

0 comments on commit 727292e

Please sign in to comment.