From 5c6862fb884813b7c60129e9df23103510e53f73 Mon Sep 17 00:00:00 2001 From: Desi McAdam Date: Tue, 25 Feb 2025 10:22:19 -0700 Subject: [PATCH] feat(ci): Auto add needs-triage label on bug open (#30512) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** We use the stale bot in order to make sure we close out issues which have been open and waiting on additional information from reporters for too long. However, sometimes this can be the case for issues that we just haven't had an opportunity to follow back up on. We feel a couple of process improvements can make this better. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30512?quickstart=1) ## **Related issues** Partially fixes: https://github.com/MetaMask/MetaMask-planning/issues/4219 Related to: https://github.com/MetaMask/github-tools/pull/41/files ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .github/scripts/check-template-and-add-labels.ts | 11 +++++++++++ .github/scripts/shared/label.ts | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/.github/scripts/check-template-and-add-labels.ts b/.github/scripts/check-template-and-add-labels.ts index dd54fe7e849e..eb2e5578e057 100644 --- a/.github/scripts/check-template-and-add-labels.ts +++ b/.github/scripts/check-template-and-add-labels.ts @@ -16,6 +16,7 @@ import { RegressionStage, craftRegressionLabel, externalContributorLabel, + needsTriageLabel, flakyTestsLabel, invalidIssueTemplateLabel, invalidPullRequestTemplateLabel, @@ -139,6 +140,9 @@ async function main(): Promise { // Add regression label to the bug report issue addRegressionLabelToIssue(octokit, labelable); + + // Add needs triage label to the bug report issue + addNeedsTriageLabelToIssue(octokit, labelable); } else { const errorMessage = "Issue body does not match any of expected templates ('general-issue.yml' or 'bug-report.yml').\n\nMake sure issue's body includes all section titles.\n\nSections titles are listed here: https://github.com/MetaMask/metamask-extension/blob/main/.github/scripts/shared/template.ts#L14-L37"; @@ -260,6 +264,13 @@ function extractReleaseVersionFromBugReportIssueBody( return version; } +// This function adds the "needs-triage" label to the issue if it doesn't have it +function addNeedsTriageLabelToIssue( + octokit: InstanceType, + issue: Labelable, +): Promise { + await addLabelToLabelable(octokit, issue, needsTriageLabel); +} // This function adds the correct regression label to the issue, and removes other ones async function addRegressionLabelToIssue( octokit: InstanceType, diff --git a/.github/scripts/shared/label.ts b/.github/scripts/shared/label.ts index 42447e27937f..e13ab2824fac 100644 --- a/.github/scripts/shared/label.ts +++ b/.github/scripts/shared/label.ts @@ -27,6 +27,12 @@ export const externalContributorLabel: Label = { description: 'Issue or PR created by user outside org', }; +export const needsTriageLabel: Label = { + name: 'needs-triage', + color: '#68AEE6', + description: 'Issue needs to be triaged', +}; + export const flakyTestsLabel: Label = { name: 'flaky tests', color: 'BE564E',