Skip to content

Commit

Permalink
feat(ci): Auto add needs-triage label on bug open (#30512)
Browse files Browse the repository at this point in the history
## **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:
MetaMask/MetaMask-planning#4219

Related to:
https://github.com/MetaMask/github-tools/pull/41/files


## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **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.
  • Loading branch information
desi authored Feb 25, 2025
1 parent 5ddd7e9 commit 5c6862f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/scripts/check-template-and-add-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
RegressionStage,
craftRegressionLabel,
externalContributorLabel,
needsTriageLabel,
flakyTestsLabel,
invalidIssueTemplateLabel,
invalidPullRequestTemplateLabel,
Expand Down Expand Up @@ -139,6 +140,9 @@ async function main(): Promise<void> {

// 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";
Expand Down Expand Up @@ -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<typeof GitHub>,
issue: Labelable,
): Promise<void> {

Check failure on line 271 in .github/scripts/check-template-and-add-labels.ts

View workflow job for this annotation

GitHub Actions / check-template-and-add-labels

A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
await addLabelToLabelable(octokit, issue, needsTriageLabel);

Check failure on line 272 in .github/scripts/check-template-and-add-labels.ts

View workflow job for this annotation

GitHub Actions / check-template-and-add-labels

'await' expressions are only allowed within async functions and at the top levels of modules.
}
// This function adds the correct regression label to the issue, and removes other ones
async function addRegressionLabelToIssue(
octokit: InstanceType<typeof GitHub>,
Expand Down
6 changes: 6 additions & 0 deletions .github/scripts/shared/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 5c6862f

Please sign in to comment.