Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Auto add needs-triage label on bug open #30512

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> {
await addLabelToLabelable(octokit, issue, needsTriageLabel);
}
// 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
Loading