From 4b3eab38ef51e08171cd068e4b38722e7f806bd7 Mon Sep 17 00:00:00 2001 From: Jesse Squire Date: Fri, 20 May 2022 10:52:00 -0400 Subject: [PATCH] [Bot Rules] Adding missing automation for flagging/closing stale pull requests and responding when `CXP Attention` is added to an issue. --- .github/fabricbot.json | 459 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 459 insertions(+) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index de5ea27b9d18..ef0e0a70dd6d 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -3974,5 +3974,464 @@ } ] } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "labelAdded", + "parameters": { + "label": "CXP Attention" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "Service Attention" + } + } + ] + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "[CXP Pilot] CXP Attention Responder", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Thank you for your feedback. This has been routed to the support team for assistance." + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "operator": "or", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "merged" + } + }, + { + "name": "isAction", + "parameters": { + "action": "synchronize" + } + }, + { + "name": "isAction", + "parameters": { + "action": "review_requested" + } + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "pull_request", + "issues", + "project_card" + ], + "taskName": "[Stale Pull Requests] Remove Stale PR Designation on Activity", + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestReviewResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "isOpen", + "parameters": {} + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "pull_request_review" + ], + "taskName": "[Stale Pull Requests] Remove Stale PR Designation on on Review", + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestCommentResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "created" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "commentContains", + "parameters": { + "commentPattern": "What is Check Enforcer?" + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "commentContains", + "parameters": { + "commentPattern": "Since there hasn't been recent engagement, this is being closed out." + } + } + ] + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "issue_comment" + ], + "taskName": "[Stale Pull Requests] Remove Stale PR Designation on on Comment", + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 0, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + }, + { + "weekDay": 1, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + }, + { + "weekDay": 2, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + }, + { + "weekDay": 3, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + }, + { + "weekDay": 4, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + }, + { + "weekDay": 5, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + }, + { + "weekDay": 6, + "hours": [ + 1, + 7, + 13, + 19 + ], + "timezoneOffset": -4 + } + ], + "searchTerms": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "isPr", + "parameters": {} + }, + { + "name": "noActivitySince", + "parameters": { + "days": 7 + } + } + ], + "taskName": "[Stale Pull Requests] Scheduled Close for Stale PRs", + "actions": [ + { + "name": "closeIssue", + "parameters": {} + }, + { + "name": "addReply", + "parameters": { + "comment": "Hi @${issueAuthor}. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing \"/reopen\" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the \"no-recent-activity\" label; otherwise, this is likely to be closed again with the next cleanup pass. " + } + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "PullRequestCommentResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isOpen", + "parameters": {} + } + ] + }, + { + "name": "commentContains", + "parameters": { + "commentPattern": "/reopen" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "operator": "or", + "operands": [ + { + "name": "isActivitySender", + "parameters": { + "user": { + "type": "author" + } + } + }, + { + "name": "activitySenderHasPermissions", + "parameters": { + "permissions": "admin" + } + }, + { + "name": "activitySenderHasPermissions", + "parameters": { + "permissions": "write" + } + } + ] + } + ] + }, + "eventType": "pull_request", + "eventNames": [ + "issue_comment" + ], + "taskName": "[Stale Pull Requests] Reopen Command", + "actions": [ + { + "name": "reopenIssue", + "parameters": {} + }, + { + "name": "removeLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 5, + "hours": [ + 5 + ], + "timezoneOffset": -5 + } + ], + "searchTerms": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "noLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 60 + } + }, + { + "name": "isPr", + "parameters": {} + } + ], + "taskName": "[Stale Pull Requests] Scheduled Marking of Stale PRs", + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "addReply", + "parameters": { + "comment": "Hi @${issueAuthor}. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days." + } + } + ] + } } ]