Skip to content

Commit

Permalink
Add rule for deprecating singletons (#181585)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trenly authored Oct 11, 2024
1 parent c36cc5a commit 7a42344
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/policies/labelAdded.manifestSingletonDeprecated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
id: labelAdded.manifestSingletonDeprecated
name: GitOps.PullRequestIssueManagement
description: Handlers when "Manifest-Singleton-Deprecated" label is added
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: >-
When the label "Manifest-Singleton-Deprecated" is added to a pull request
* Add the PR specific reply notifying the issue author
* Assign to the Author
* Label with Needs-Author-Feedback
* Remove the Needs-Attention Label
if:
- payloadType: Pull_Request
- labelAdded:
label: Manifest-Singleton-Deprecated
then:
- addReply:
reply: >-
Hello @${issueAuthor},
The package manager bot determined that your submission uses a `Singleton` Manifest, which been deprecated in this repository. Please update your submission to use the newer multi-manifest format. If you built your manifest by hand, a tool like [WingetCreate](https://github.com/microsoft/winget-create) or [YamlCreate](https://github.com/microsoft/winget-pkgs/blob/master/doc/tools/YamlCreate.md) can help you build the multi-manifest.
Template: msftbot/validationError/manifest/singleton/deprecated
- assignTo:
author: True
- addLabel:
label: Needs-Author-Feedback
- removeLabel:
label: Needs-Attention
# The policy service should trigger even when the label was added by the policy service
triggerOnOwnActions: true
onFailure:
onSuccess:
2 changes: 1 addition & 1 deletion .github/policies/labelAdded.manifestVersionDeprecated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: >-
When the label "Manifest-Version-Error" is added to a pull request
When the label "Manifest-Version-Deprecated" is added to a pull request
* Add the PR specific reply notifying the issue author
* Assign to the Author
* Label with Needs-Author-Feedback
Expand Down
30 changes: 30 additions & 0 deletions .github/policies/labelManagement.issueOpened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,35 @@ configuration:
then:
- addLabel:
label: Author-Not-Authorized
- description: >-
When a PR is opened/updated, if
* The files are in /manifests
* The files match *.yaml
* The files do not match *.installer.yaml
* The files do no match *.locale.yaml
Then
* Add label Manifest-Singleton-Deprecated
if:
- payloadType: Pull_Request
- isOpen
- or:
- isAction:
action: Opened
- isAction:
action: Synchronize
- not:
filesMatchPattern: # has at least one file
pattern: ^$
- filesMatchPattern:
pattern: ^manifests/.*\.yaml # matches manifests/*.yaml
- not:
filesMatchPattern:
pattern: ^manifests/.*\.installer\.yaml # matches manifests/*.installer.yaml
- not:
filesMatchPattern:
pattern: ^manifests/.*\.locale\..*\.yaml # matches manifests/*.locale.*.yaml
then:
- addLabel:
label: Manifest-Singleton-Deprecated
onFailure:
onSuccess:

0 comments on commit 7a42344

Please sign in to comment.