Skip to content

Commit

Permalink
chore: disable auto-labeling
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Nov 30, 2022
1 parent 7bd1703 commit b0aa73b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/actions/issue-validator/index.mjs

Large diffs are not rendered by default.

70 changes: 38 additions & 32 deletions .github/actions/issue-validator/src/index.mjs
Expand Up @@ -8,7 +8,7 @@ import { join } from 'node:path'

const verifyCanaryLabel = 'please verify canary'
const addReproductionLabel = 'please add a complete reproduction'
const bugLabel = 'template: bug'
// const bugLabel = 'template: bug'
const __dirname =
'/home/runner/work/next.js/next.js/.github/actions/issue-validator'

Expand Down Expand Up @@ -48,11 +48,11 @@ async function run() {
if (pull_request || !issue?.body || !process.env.GITHUB_TOKEN) return

const labels = issue.labels.map((l) => l.name)
const isBugReport =
labels.includes(bugLabel) || newLabel === bugLabel || !labels.length
// const isBugReport =
// labels.includes(bugLabel) || newLabel === bugLabel || !labels.length

if (
!(isBugReport && issue.number > 43554) &&
// !(isBugReport && issue.number > 43554) &&
![verifyCanaryLabel, addReproductionLabel].includes(newLabel) &&
!(
labels.includes(verifyCanaryLabel) ||
Expand All @@ -64,33 +64,36 @@ async function run() {
)
}

/** @param {string|null|undefined} link */
async function hasRepro(link) {
if (!link) return false
try {
const url = new URL(link)
if (['example.com'].includes(url.hostname)) {
return false
}
} catch {
return false
}
const response = await fetch(link)
return response.ok
}
// /** @param {string|null|undefined} link */
// async function hasRepro(link) {
// if (!link) return false
// try {
// const url = new URL(link)
// if (['example.com'].includes(url.hostname)) {
// return false
// }
// } catch {
// return false
// }
// const response = await fetch(link)
// return response.ok
// }

const hasValidRepro =
isBugReport &&
(await hasRepro(
issue.body.match(
/will be addressed faster\n\n(.*)\n\n### To Reproduce/i
)?.[1]
))
// const hasValidRepro =
// isBugReport &&
// (await hasRepro(
// issue.body.match(
// /will be addressed faster\n\n(.*)\n\n### To Reproduce/i
// )?.[1]
// ))

const client = github.getOctokit(process.env.GITHUB_TOKEN).rest
const issueCommon = { ...repo, issue_number: issue.number }

if (newLabel === addReproductionLabel || !hasValidRepro) {
if (
newLabel === addReproductionLabel
// || !hasValidRepro
) {
await Promise.all([
client.issues.addLabels({
...issueCommon,
Expand All @@ -106,13 +109,16 @@ async function run() {
)
}

const isVerifyCanaryChecked =
isBugReport &&
issue.body.match(
/- \[x\] I verified that the issue exists in the latest Next.js canary release/i
)
// const isVerifyCanaryChecked =
// isBugReport &&
// issue.body.match(
// /- \[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([
client.issues.addLabels({
...issueCommon,
Expand Down

0 comments on commit b0aa73b

Please sign in to comment.