Commit b0aa73b4 authored by Balázs Orbán's avatar Balázs Orbán

chore: disable auto-labeling

parent 7bd17038
This diff is collapsed.
...@@ -8,7 +8,7 @@ import { join } from 'node:path' ...@@ -8,7 +8,7 @@ import { join } from 'node:path'
const verifyCanaryLabel = 'please verify canary' const verifyCanaryLabel = 'please verify canary'
const addReproductionLabel = 'please add a complete reproduction' const addReproductionLabel = 'please add a complete reproduction'
const bugLabel = 'template: bug' // const bugLabel = 'template: bug'
const __dirname = const __dirname =
'/home/runner/work/next.js/next.js/.github/actions/issue-validator' '/home/runner/work/next.js/next.js/.github/actions/issue-validator'
...@@ -48,11 +48,11 @@ async function run() { ...@@ -48,11 +48,11 @@ async function run() {
if (pull_request || !issue?.body || !process.env.GITHUB_TOKEN) return if (pull_request || !issue?.body || !process.env.GITHUB_TOKEN) return
const labels = issue.labels.map((l) => l.name) const labels = issue.labels.map((l) => l.name)
const isBugReport = // const isBugReport =
labels.includes(bugLabel) || newLabel === bugLabel || !labels.length // labels.includes(bugLabel) || newLabel === bugLabel || !labels.length
if ( if (
!(isBugReport && issue.number > 43554) && // !(isBugReport && issue.number > 43554) &&
![verifyCanaryLabel, addReproductionLabel].includes(newLabel) && ![verifyCanaryLabel, addReproductionLabel].includes(newLabel) &&
!( !(
labels.includes(verifyCanaryLabel) || labels.includes(verifyCanaryLabel) ||
...@@ -64,33 +64,36 @@ async function run() { ...@@ -64,33 +64,36 @@ async function run() {
) )
} }
/** @param {string|null|undefined} link */ // /** @param {string|null|undefined} link */
async function hasRepro(link) { // async function hasRepro(link) {
if (!link) return false // if (!link) return false
try { // try {
const url = new URL(link) // const url = new URL(link)
if (['example.com'].includes(url.hostname)) { // if (['example.com'].includes(url.hostname)) {
return false // return false
} // }
} catch { // } catch {
return false // return false
} // }
const response = await fetch(link) // const response = await fetch(link)
return response.ok // return response.ok
} // }
const hasValidRepro = // const hasValidRepro =
isBugReport && // isBugReport &&
(await hasRepro( // (await hasRepro(
issue.body.match( // issue.body.match(
/will be addressed faster\n\n(.*)\n\n### To Reproduce/i // /will be addressed faster\n\n(.*)\n\n### To Reproduce/i
)?.[1] // )?.[1]
)) // ))
const client = github.getOctokit(process.env.GITHUB_TOKEN).rest const client = github.getOctokit(process.env.GITHUB_TOKEN).rest
const issueCommon = { ...repo, issue_number: issue.number } const issueCommon = { ...repo, issue_number: issue.number }
if (newLabel === addReproductionLabel || !hasValidRepro) { if (
newLabel === addReproductionLabel
// || !hasValidRepro
) {
await Promise.all([ await Promise.all([
client.issues.addLabels({ client.issues.addLabels({
...issueCommon, ...issueCommon,
...@@ -106,13 +109,16 @@ async function run() { ...@@ -106,13 +109,16 @@ async function run() {
) )
} }
const isVerifyCanaryChecked = // const isVerifyCanaryChecked =
isBugReport && // isBugReport &&
issue.body.match( // issue.body.match(
/- \[x\] I verified that the issue exists in the latest Next.js canary release/i // /- \[x\] I verified that the issue exists in the latest Next.js canary release/i
) // )
if (newLabel === verifyCanaryLabel || !isVerifyCanaryChecked) { if (
newLabel === verifyCanaryLabel
// || !isVerifyCanaryChecked
) {
await Promise.all([ await Promise.all([
client.issues.addLabels({ client.issues.addLabels({
...issueCommon, ...issueCommon,
......
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