-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into remove-error-page-debug
- Loading branch information
Showing
36 changed files
with
1,271 additions
and
121 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
1,001 changes: 1,001 additions & 0 deletions
1,001
.github/actions/next-repo-info/dist/prs/licenses.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,5 @@ | |
"registry": "https://registry.npmjs.org/" | ||
} | ||
}, | ||
"version": "14.1.1-canary.42" | ||
"version": "14.1.1-canary.43" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.