(issueNumber: number)
| 76 | } |
| 77 | |
| 78 | async function validateIssueAsync(issueNumber: number) { |
| 79 | const issue = await getIssueAsync(issueNumber); |
| 80 | if (!issue) { |
| 81 | throw new Error(`Issue #${issueNumber} does not exist.`); |
| 82 | } |
| 83 | |
| 84 | // Skip if we already applied some other label |
| 85 | for (const label of issue.labels) { |
| 86 | const labelName = typeof label === 'string' ? label : label.name; |
| 87 | if (labelName && labelName === 'needs validation') { |
| 88 | // Remove the validation label since we've started validation |
| 89 | console.log('found needs validation label, removing it.'); |
| 90 | try { |
| 91 | await removeIssueLabelAsync(issueNumber, 'needs validation'); |
| 92 | } catch (e) { |
| 93 | console.log(e); |
| 94 | } |
| 95 | } else if (labelName && SKIP_VALIDATION_LABELS.includes(labelName)) { |
| 96 | console.log(`Issue is labeled with ${labelName}, skipping validation.`); |
| 97 | return; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | // Maybe actually match the full URL and print it? |
| 102 | const matches = REPRO_URI_REGEXES.map((regex) => |
| 103 | (issue.body?.toLowerCase() ?? '').match(regex) |
| 104 | ).filter(Boolean); |
| 105 | |
| 106 | const includesReproUri = matches.length > 0; |
| 107 | |
| 108 | if (includesReproUri) { |
| 109 | console.log('Issue includes a reprodible example URI.'); |
| 110 | console.log('adding needs review label.'); |
| 111 | await addIssueLabelsAsync(issueNumber, ['needs review']); |
| 112 | } else { |
| 113 | console.log(issue.labels); |
| 114 | if (issue.labels?.includes('needs review')) { |
| 115 | console.log('needs review label found, removing it.'); |
| 116 | try { |
| 117 | await removeIssueLabelAsync(issueNumber, 'needs review'); |
| 118 | } catch (e) { |
| 119 | console.log(e); |
| 120 | } |
| 121 | } |
| 122 | await addIssueLabelsAsync(issueNumber, ['incomplete issue: missing or invalid repro']); |
| 123 | console.log('No reproducible example provided, marked for closing.'); |
| 124 | } |
| 125 | } |
no test coverage detected
searching dependent graphs…