-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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 kdy1/acorn-bugs
- Loading branch information
Showing
671 changed files
with
61,245 additions
and
70,552 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
.github/actions/next-repo-info/dist/feature-requests/index.mjs
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/feature-requests/licenses.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
113 changes: 113 additions & 0 deletions
113
.github/actions/next-repo-info/src/feature-requests.mjs
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,113 @@ | ||
// @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 {number} number | ||
* @property {string} title | ||
* @property {string} url | ||
* @property {number} upvoteCount | ||
* @property {string} createdAt | ||
* | ||
* @typedef {{ search: Search }} GraphQLResponse | ||
* | ||
* @typedef Item | ||
* @property {string} title | ||
* @property {number} number | ||
* @property {string} html_url | ||
* @property {string} created_at | ||
* @property {number} reactions | ||
*/ | ||
|
||
/** @param {Item[]} items */ | ||
function generateBlocks(items) { | ||
const blocks = [ | ||
{ | ||
type: 'section', | ||
text: { | ||
type: 'mrkdwn', | ||
text: '*A list of the top 15 feature requests sorted by 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-info/src/feature-requests.mjs|action> will run every Monday at 1PM UTC (9AM EST)._', | ||
}, | ||
}, | ||
{ | ||
type: 'divider', | ||
}, | ||
] | ||
|
||
let text = '' | ||
|
||
items.forEach((item, i) => { | ||
text += `${i + 1}. [<${item.html_url}|#${item.number}>, :+1: ${ | ||
item.reactions['+1'] | ||
}, ${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), | ||
reactions: node.upvoteCount, | ||
})) | ||
|
||
await slackClient.chat.postMessage({ | ||
blocks: generateBlocks(items), | ||
channel: '#team-next-js', | ||
icon_emoji: ':github:', | ||
username: 'GitHub Notifier', | ||
}) | ||
|
||
info(`Posted to Slack!`) | ||
} catch (error) { | ||
setFailed(error) | ||
} | ||
} | ||
|
||
run() |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days | ||
|
||
on: | ||
schedule: | ||
- cron: '0 13 * * 1' # Every Monday at 1PM UTC (9AM EST) | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run: | ||
if: github.repository_owner == 'vercel' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
- run: corepack enable | ||
- name: 'Issues: Send notification to Slack' | ||
run: node ./.github/actions/next-repo-info/dist/issues/index.mjs | ||
continue-on-error: true | ||
- name: 'PRs: Send notification to Slack' | ||
run: node ./.github/actions/next-repo-info/dist/prs/index.mjs | ||
continue-on-error: true | ||
- name: 'Feature requests: Send notification to Slack' | ||
run: node ./.github/actions/next-repo-info/dist/feature-requests/index.mjs | ||
continue-on-error: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |
This file was deleted.
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
Oops, something went wrong.