Skip to content

Commit

Permalink
Add automation for label Highest-Version-Remaining - round 3
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengillie authored Jun 7, 2024
1 parent cef406f commit 72a1183
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 45 deletions.
38 changes: 38 additions & 0 deletions .github/policies/labelAdded.highestVersionRemoval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
id: labelAdded.highestVersionRemoval
name: GitOps.PullRequestIssueManagement
description: Handlers when "Highest-Version-Removal" label is added
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: >-
When the label "Highest-Version-Removal" is added to a pull request
* Add a reply notifying the issue author
* Assign to the author
* Label with Needs-Author-Feedback
if:
- payloadType: Pull_Request
- labelAdded:
label: Highest-Version-Removal
then:
- addReply:
reply: >-
Hello @${issueAuthor},
This PR removes the highest available version of the package from the repository.
Please provide the reason for removal to help our moderators understand the context.
Template: msftbot/highestVersionRemoval
- assignTo:
author: True
- addLabel:
label: Needs-Author-Feedback
# The policy service should trigger even when the label was added by the policy service
triggerOnOwnActions: true
onFailure:
onSuccess:
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
id: labelAdded.highestVersionRemaining
name: GitOps.PullRequestIssueManagement
description: Handlers when "Highest-Version-Remaining" label is added
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: >-
When the label "Highest-Version-Remaining" is added to a pull request
* Add a reply notifying the issue author
* Assign to the author
* Label with Needs-Author-Feedback
if:
- payloadType: Pull_Request
- labelAdded:
label: Highest-Version-Remaining
then:
- addReply:
reply: >-
Hello @${issueAuthor},
This PR removes the last version of the package from the repository.
Please check if the package requires an update or is available from another source.
Template: msftbot/highestVersionRemaining
- assignTo:
author: True
- addLabel:
label: Needs-Author-Feedback
# The policy service should trigger even when the label was added by the policy service
triggerOnOwnActions: true
onFailure:
onSuccess:
id: labelAdded.lastVersionRemoval
name: GitOps.PullRequestIssueManagement
description: Handlers when "Last-Version-Removal" label is added
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: >-
When the label "Last-Version-Removal" is added to a pull request
* Add a reply notifying the issue author
* Assign to the author
* Label with Needs-Author-Feedback
if:
- payloadType: Pull_Request
- labelAdded:
label: Last-Version-Removal
then:
- addReply:
reply: >-
Hello @${issueAuthor},
This PR removes the last version of the package from the repository.
Please check if the package requires an update or is available from another source.
Template: msftbot/lastVersionRemoval
- assignTo:
author: True
- addLabel:
label: Needs-Author-Feedback
# The policy service should trigger even when the label was added by the policy service
triggerOnOwnActions: true
onFailure:
onSuccess:
18 changes: 14 additions & 4 deletions .github/policies/moderatorTriggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,22 @@ configuration:
then:
- addLabel:
label: Issue-Feature
# Highest-Version-Remaining
# Highest-Version-Removal
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[Hh]ighest[\s-][Vv]ersion([\s-][Rr]emaining)?'
pattern: '\[[Pp]olicy\]\s+[Hh]ighest[\s-][Vv]ersion([\s-][Rr]emoval)?'
isRegex: True
then:
- addLabel:
label: Highest-Version-Remaining
label: Highest-Version-Removal
# Last-Version-Removal
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[Ll]ast[\s-][Vv]ersion([\s-][Rr]emoval)?'
isRegex: True
then:
- addLabel:
label: Last-Version-Removal
# License-Blocks-Install
- if:
- commentContains:
Expand Down Expand Up @@ -458,7 +466,7 @@ configuration:
- removeLabel:
label: Help-Wanted
- removeLabel:
label: Highest-Version-Remaining
label: Highest-Version-Removal
- removeLabel:
label: In-PR
- removeLabel:
Expand All @@ -471,6 +479,8 @@ configuration:
label: Issue-Docs
- removeLabel:
label: Issue-Feature
- removeLabel:
label: Last-Version-Removal
- removeLabel:
label: License-Blocks-Install
- removeLabel:
Expand Down
3 changes: 2 additions & 1 deletion doc/Moderation.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ Moderators are often the first to see and triage new issues, and so they have th
* `Issue-Bug`
* `Issue-Docs`
* `Issue-Feature`
* `Highest-Version-Remaining`
* `Highest-Version-Removal`
* `Last-Version-Removal`
* `License-Blocks-Install`
* `Manifest-Content-Incomplete`
* `Moderator-Approved`
Expand Down

0 comments on commit 72a1183

Please sign in to comment.