Skip to content

Commit

Permalink
Merge branch 'canary' into remove-error-page-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Feb 7, 2024
2 parents 4bdbb25 + ed3ee38 commit 8710a55
Show file tree
Hide file tree
Showing 36 changed files with 1,271 additions and 121 deletions.
8 changes: 4 additions & 4 deletions .github/actions/next-repo-info/dist/issues/index.mjs

Large diffs are not rendered by default.

46 changes: 29 additions & 17 deletions .github/actions/next-repo-info/dist/issues/licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,30 @@ MIT

@slack/web-api
MIT
MIT License

Copyright (c) 2014- Slack Technologies, LLC

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



@vercel/ncc
MIT
Expand Down Expand Up @@ -663,27 +687,15 @@ SOFTWARE.

is-stream
MIT
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


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

Large diffs are not rendered by default.

1,001 changes: 1,001 additions & 0 deletions .github/actions/next-repo-info/dist/prs/licenses.txt

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions .github/actions/next-repo-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"private": true,
"description": "Notify Next.js team about pending PRs and popular issues",
"scripts": {
"build-issues": "ncc build src/popular-issues.mjs -m -o dist/issues --license licenses.txt"
"build": "pnpm build-issues && pnpm build-prs",
"build-issues": "ncc build src/popular-issues.mjs -m -o dist/issues --license licenses.txt",
"build-prs": "ncc build src/popular-prs.mjs -m -o dist/prs --license licenses.txt"
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "6.0.0",
"@slack/web-api": "^6.11.2"
"@slack/web-api": "^7.0.1"
},
"devDependencies": {
"@vercel/ncc": "^0.38.1"
Expand Down
16 changes: 8 additions & 8 deletions .github/actions/next-repo-info/src/popular-issues.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ import { context, getOctokit } from '@actions/github'
import { setFailed, info } from '@actions/core'
import { WebClient } from '@slack/web-api'

// Get the date 90 days ago (YYYY-MM-DD)
function getNinetyDaysAgoDate() {
const date = new Date()
date.setDate(date.getDate() - 90)
return date.toISOString().split('T')[0]
}

function generateBlocks(issues) {
const blocks = [
{
Expand All @@ -23,19 +16,22 @@ function generateBlocks(issues) {
type: 'divider',
},
]

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

blocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: text,
},
})

return blocks
}

Expand All @@ -47,7 +43,11 @@ async function run() {
const octoClient = getOctokit(process.env.GITHUB_TOKEN)
const slackClient = new WebClient(process.env.SLACK_TOKEN)

const ninetyDaysAgo = getNinetyDaysAgoDate()
// Get the date 90 days ago (YYYY-MM-DD)
const date = new Date()
date.setDate(date.getDate() - 90)
const ninetyDaysAgo = date.toISOString().split('T')[0]

const { owner, repo } = context.repo
const { data } = await octoClient.rest.search.issuesAndPullRequests({
order: 'desc',
Expand Down
76 changes: 76 additions & 0 deletions .github/actions/next-repo-info/src/popular-prs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// @ts-check
import { context, getOctokit } from '@actions/github'
import { setFailed, info } from '@actions/core'
import { WebClient } from '@slack/web-api'

function generateBlocks(prs) {
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`
})

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)

// Get the date 90 days ago (YYYY-MM-DD)
const date = new Date()
date.setDate(date.getDate() - 90)
const ninetyDaysAgo = date.toISOString().split('T')[0]

const { owner, repo } = context.repo
const { data } = await octoClient.rest.search.issuesAndPullRequests({
order: 'desc',
per_page: 15,
q: `repo:${owner}/${repo} is:pr is:open created:>=${ninetyDaysAgo}`,
sort: 'reactions-+1',
})

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

info(`Posted to Slack!`)
} else {
info(`No popular PRs`)
}
} catch (error) {
setFailed(error)
}
}

run()
66 changes: 23 additions & 43 deletions .github/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/issue_popular.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Notify about the top 15 issues (most reacted) in the last month
name: Notify about the top 15 issues (most reacted) in the last 90 days

on:
schedule:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/pull_request_popular.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Notify about the top 15 PRs (most reacted) in the last 90 days

on:
schedule:
- cron: '0 13 * * 1' # Every Monday at 1PM UTC (9AM EST)
workflow_dispatch:

jobs:
popular-issues:
if: github.repository_owner == 'vercel'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: corepack enable
- name: 'Send notification to Slack'
run: node ./.github/actions/next-repo-info/dist/prs/index.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "14.1.1-canary.42"
"version": "14.1.1-canary.43"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "14.1.1-canary.42",
"version": "14.1.1-canary.43",
"keywords": [
"react",
"next",
Expand Down
Loading

0 comments on commit 8710a55

Please sign in to comment.