Stop labeling reopened triaged issues as 'needs triage' (#63615)
Release Notes: - N/A
This commit is contained in:
1 file changed
+16
-4
@@ -57,15 +57,27 @@ jobs:
|
||||
github-token: ${{ steps.get-app-token.outputs.token }}
|
||||
script: |
|
||||
const issue = context.payload.issue;
|
||||
const hasTriageLabel = issue.labels.some(
|
||||
label => label.name === 'state:needs triage'
|
||||
);
|
||||
const labelNames = issue.labels.map(label => label.name);
|
||||
|
||||
if (hasTriageLabel) {
|
||||
if (labelNames.includes('state:needs triage')) {
|
||||
console.log('Issue already has state:needs triage, skipping');
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.payload.action === 'reopened') {
|
||||
const requiredPrefixes = ['area:', 'reach:', 'severity:'];
|
||||
const alreadyTriaged = requiredPrefixes.every(
|
||||
prefix => labelNames.some(name => name.startsWith(prefix))
|
||||
);
|
||||
|
||||
if (alreadyTriaged) {
|
||||
console.log(
|
||||
`Reopened issue #${issue.number} already has area:, reach: and severity: labels, skipping`
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
|
||||
Reference in new issue
Block a user