Skip to content

Commit

Permalink
Add generated policy to remove needs-triage when an area is added (#3366
Browse files Browse the repository at this point in the history
)

Generate the Microsoft policy service files to automatically to:
- add/remove `needs-triage` automatically when there is no area or an
area is added
- add the area on PRs


resolve #3340
  • Loading branch information
timotheeguerin authored May 16, 2024
1 parent 8424b2e commit eac8011
Show file tree
Hide file tree
Showing 17 changed files with 889 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .github/policies/issues.needs-info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ configuration:
- assignTo:
users: []
- addLabel:
label: needs-triage
label: needs-area
- removeLabel:
label: needs-info
onFailure:
Expand Down
139 changes: 139 additions & 0 deletions .github/policies/issues.triage.generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# This file is generated by the sync-labels script DO NOT EDIT manually
id: issues.triage
name: New Issue Assign labels
description: Assign labels to new issues
resource: repository
disabled: false
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: Adds `needs-area` label for new unassigned issues
if:
- payloadType: Issues
- isAction:
action: Opened
- not:
and:
- isAssignedToSomeone
then:
- addLabel:
label: needs-area
- description: Remove `needs-area` label when an area label is added
if:
- payloadType: Issues
- hasLabel:
label: needs-area
- isOpen
- 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-area
- description: Add `needs-area` back when all area labels are removed
if:
- payloadType: Issues
- not:
hasLabel:
label: needs-area
- isOpen
- or:
- labelRemoved:
label: compiler:core
- labelRemoved:
label: compiler:emitter-framework
- labelRemoved:
label: ide
- labelRemoved:
label: lib:http
- labelRemoved:
label: lib:openapi
- labelRemoved:
label: lib:rest
- labelRemoved:
label: lib:versioning
- labelRemoved:
label: meta:blog
- labelRemoved:
label: meta:website
- labelRemoved:
label: tspd
- labelRemoved:
label: emitter:client:csharp
- labelRemoved:
label: emitter:json-schema
- labelRemoved:
label: emitter:protobuf
- labelRemoved:
label: emitter:service:csharp
- labelRemoved:
label: emitter:service:js
- labelRemoved:
label: eng
- not:
or:
- hasLabel:
label: compiler:core
- hasLabel:
label: compiler:emitter-framework
- hasLabel:
label: ide
- hasLabel:
label: lib:http
- hasLabel:
label: lib:openapi
- hasLabel:
label: lib:rest
- hasLabel:
label: lib:versioning
- hasLabel:
label: meta:blog
- hasLabel:
label: meta:website
- hasLabel:
label: tspd
- hasLabel:
label: emitter:client:csharp
- hasLabel:
label: emitter:json-schema
- hasLabel:
label: emitter:protobuf
- hasLabel:
label: emitter:service:csharp
- hasLabel:
label: emitter:service:js
- hasLabel:
label: eng
then:
- removeLabel:
label: needs-area
26 changes: 0 additions & 26 deletions .github/policies/issues.triage.yml

This file was deleted.

125 changes: 125 additions & 0 deletions .github/policies/prs.triage.generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# This file is generated by the sync-labels script DO NOT EDIT manually
id: prs.triage
name: Assign area labels to PRs
description: Assign area labels to PR depending on path modified.
resource: repository
disabled: false
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: Assign area labels to PRs based on modified files
if:
- payloadType: Pull_Request
- isOpen
then:
- if:
- includesModifiedFiles:
files:
- packages/compiler
then:
- addLabel:
label: compiler:core
- if:
- includesModifiedFiles:
files: []
then:
- addLabel:
label: compiler:emitter-framework
- if:
- includesModifiedFiles:
files:
- packages/typespec-vscode
- packages/typespec-vs
then:
- addLabel:
label: ide
- if:
- includesModifiedFiles:
files:
- packages/http
then:
- addLabel:
label: lib:http
- if:
- includesModifiedFiles:
files:
- packages/openapi
then:
- addLabel:
label: lib:openapi
- if:
- includesModifiedFiles:
files:
- packages/rest
then:
- addLabel:
label: lib:rest
- if:
- includesModifiedFiles:
files:
- packages/versioning
then:
- addLabel:
label: lib:versioning
- if:
- includesModifiedFiles:
files:
- blog
then:
- addLabel:
label: meta:blog
- if:
- includesModifiedFiles:
files:
- website
then:
- addLabel:
label: meta:website
- if:
- includesModifiedFiles:
files:
- packages/tspd
then:
- addLabel:
label: tspd
- if:
- includesModifiedFiles:
files:
- packages/http-client-csharp
then:
- addLabel:
label: emitter:client:csharp
- if:
- includesModifiedFiles:
files:
- packages/json-schema
then:
- addLabel:
label: emitter:json-schema
- if:
- includesModifiedFiles:
files:
- packages/protobuf
then:
- addLabel:
label: emitter:protobuf
- if:
- includesModifiedFiles:
files: []
then:
- addLabel:
label: emitter:service:csharp
- if:
- includesModifiedFiles:
files: []
then:
- addLabel:
label: emitter:service:js
- if:
- includesModifiedFiles:
files:
- eng
- .github
then:
- addLabel:
label: eng
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
Loading

0 comments on commit eac8011

Please sign in to comment.