Skip to content

Commit

Permalink
Add generated policy to remove needs-triage
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed May 15, 2024
1 parent 69d6cb7 commit fedee16
Show file tree
Hide file tree
Showing 13 changed files with 463 additions and 179 deletions.
54 changes: 44 additions & 10 deletions .github/policies/issues.triage.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,60 @@
id: issues.triage
name: New Issue Assign labels
description: Assign labels to new issues
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
scheduledSearches: []
eventResponderTasks:
- description: Adds `needs-triage` label for new unassigned issues
if:
- payloadType: Issues
- isAction:
action: Opened
- and:
- not:
and:
- isAssignedToSomeone
- not:
and:
- isAssignedToSomeone
then:
- addLabel:
label: needs-triage

onFailure:
onSuccess:
- description: Remove `needs-triage` label when an area label is added
if:
- payloadType: Issues
- hasLabel:
label: needs-triage
- or:
- labelAdded:
label: compiler:core
- labelAdded:
label: compiler:emitter-framework
- labelAdded:
label: ide
- labelAdded:
label: lib:http
- labelAdded:
label: lib:openapi
- labelAdded:
label: lib:rest
- labelAdded:
label: lib:versioning
- labelAdded:
label: meta:blog
- labelAdded:
label: meta:website
- labelAdded:
label: tspd
- labelAdded:
label: emitter:client:csharp
- labelAdded:
label: emitter:json-schema
- labelAdded:
label: emitter:protobuf
- labelAdded:
label: emitter:service:csharp
- labelAdded:
label: emitter:service:js
- labelAdded:
label: eng
then:
- removeLabel:
label: needs-triage
4 changes: 2 additions & 2 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
- "main"
paths:
- "package.json"
- "eng/common/labels.yaml"
- "eng/common/scripts/sync-labels.ts"
- "eng/common/config/"
- "eng/common/labels/"
- ".github/workflows/sync-labels.yml"

workflow_dispatch: {}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verify-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
- "main"
paths:
- "package.json"
- "eng/common/labels.yaml"
- "eng/common/scripts/sync-labels.ts"
- "eng/common/config/"
- "eng/common/labels/"
- ".github/workflows/sync-labels.yml"
- "CONTRIBUTING.md"

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ As a contributor you can run the following command to trigger the build and crea
TypeSpec repo use labels to help categorize and manage issues and PRs. The following is a list of labels and their descriptions.

<!-- LABEL GENERATED REF START -->
<!-- DO NOT EDIT: This section is automatically generated by eng/common/scripts/sync-labels.ts, update eng/common/labels.yaml run pnpm sync-labels to update -->
<!-- DO NOT EDIT: This section is automatically generated by eng/common/scripts/sync-labels.ts, update eng/common/config/labels.ts run pnpm sync-labels to update -->

### Labels reference

Expand Down
23 changes: 23 additions & 0 deletions eng/common/config/areas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { type AreaLabels } from "./labels.js";

/**
* Set the paths that each area applies to.
*/
export const AreaPaths: Record<keyof typeof AreaLabels, string[]> = {
"compiler:core": ["packages/compiler"],
"compiler:emitter-framework": [],
ide: ["packages/typespec-vscode", "packages/typespec-vs"],
"lib:http": ["packages/http"],
"lib:openapi": ["packages/openapi"],
"lib:rest": ["packages/rest"],
"lib:versioning": ["packages/versioning"],
"meta:blog": ["blog"],
"meta:website": ["website"],
tspd: ["packages/tspd"],
"emitter:client:csharp": ["packages/http-client-csharp"],
"emitter:json-schema": ["packages/json-schema"],
"emitter:protobuf": ["packages/protobuf"],
"emitter:service:csharp": [],
"emitter:service:js": [],
eng: ["eng", ".github"],
};
168 changes: 168 additions & 0 deletions eng/common/config/labels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
// cspell:ignore bfff

/**
* Labels that are used to categorize issue for which area they belong to.
*/
export const AreaLabels = defineLabels({
"compiler:core": {
color: "453261",
description: "Issues for @typespec/compiler",
},
"compiler:emitter-framework": {
color: "453261",
description: "Issues for the emitter framework",
},
ide: {
color: "846da1",
description: "Issues for VS, VSCode, Monaco, etc.",
},
"lib:http": {
color: "c7aee6",
description: "",
},
"lib:openapi": {
color: "c7aee6",
description: "",
},
"lib:rest": {
color: "c7aee6",
description: "",
},
"lib:versioning": {
color: "c7aee6",
description: "",
},
"meta:blog": {
color: "007dc8",
description: "Blog updates",
},
"meta:website": {
color: "007dc8",
description: "TypeSpec.io updates",
},
tspd: {
color: "004185",
description: "Issues for the tspd tool",
},
"emitter:client:csharp": {
color: "e1b300",
description: "",
},
"emitter:json-schema": {
color: "957300",
description: "",
},
"emitter:protobuf": {
color: "957300",
description: "The protobuf emitter",
},
"emitter:service:csharp": {
color: "967200",
description: "",
},
"emitter:service:js": {
color: "967200",
description: "",
},
eng: {
color: "65bfff",
description: "",
},
});

export default {
issue_kinds: {
description: "Issue kinds",
labels: {
bug: {
color: "d93f0b",
description: "Something isn't working",
},
feature: {
color: "cccccc",
description: "New feature or request",
},
docs: {
color: "cccccc",
description: "Improvements or additions to documentation",
},
epic: {
color: "cccccc",
description: "",
},
},
},
area: {
description: "Area of the codebase",
labels: AreaLabels,
},
"breaking-change": {
description:
"Labels around annotating issues and PR if they contain breaking change or deprecation",
labels: {
"breaking-change": {
color: "B60205",
description: "A change that might cause specs or code to break",
},
deprecation: {
color: "760205",
description:
"A previously supported feature will now report a warning and eventually be removed",
},
},
},
"design-issues": {
description: "Design issue management",
labels: {
"design:accepted": {
color: "1a4421",
description: "Proposal for design has been discussed and accepted.",
},
"design:needed": {
color: "96c499",
description: "A design request has been raised that needs a proposal",
},
"design:proposed": {
color: "56815a",
description: "Proposal has been added and ready for discussion",
},
},
},
process: {
description: "Process labels",
labels: {
"needs-triage": {
color: "ffffff",
description: "",
},
"needs-info": {
color: "ffffff",
description:
"Mark an issue that needs reply from the author or it will be closed automatically",
},
"triaged:core": {
color: "5319e7",
description: "",
},
},
},
misc: {
description: "Misc labels",
labels: {
"Client Emitter Migration": {
color: "FD92F0",
description: "",
},
"good first issue": {
color: "7057ff",
description: "Good for newcomers",
},
},
},
} as const;

function defineLabels<const T extends string>(
labels: Record<T, { color: string; description: string }>
) {
return labels;
}
Loading

0 comments on commit fedee16

Please sign in to comment.