From 140147a28df57e9ae4bc62d4b9d10078238d1311 Mon Sep 17 00:00:00 2001 From: "dotnet-policy-service[bot]" <123482357+dotnet-policy-service[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 19:26:17 +0000 Subject: [PATCH 1/4] Add prIssueManagement.yml to onboard repo to GitOps.ResourceManagement as FabricBot replacement Details on the replacement service and the syntax of the new yaml configuration file is available publicly at: https://microsoft.github.io/GitOps/policies/resource-management.html Please review and merge this PR to complete the process of onboarding to the new service. --- .github/policies/resourceManagement.yml | 293 ++++++++++++++++++++++++ 1 file changed, 293 insertions(+) create mode 100644 .github/policies/resourceManagement.yml diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml new file mode 100644 index 0000000000..1056aacbe4 --- /dev/null +++ b/.github/policies/resourceManagement.yml @@ -0,0 +1,293 @@ +id: +name: GitOps.PullRequestIssueManagement +description: GitOps.PullRequestIssueManagement primitive +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: Add no-recent-activity label to issues + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: needs-author-action + - noActivitySince: + days: 14 + - isNotLabeledWith: + label: no-recent-activity + actions: + - addLabel: + label: no-recent-activity + - addReply: + reply: This issue has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`. + - description: Add no-recent-activity label to PRs + frequencies: + - hourly: + hour: 6 + filters: + - isPullRequest + - isOpen + - hasLabel: + label: needs-author-action + - noActivitySince: + days: 14 + - isNotLabeledWith: + label: no-recent-activity + actions: + - addLabel: + label: no-recent-activity + - addReply: + reply: This pull request has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`. + - description: Close issues with no recent activity + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: no-recent-activity + - noActivitySince: + days: 14 + actions: + - addReply: + reply: This issue will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days. + - closeIssue + - description: Close PRs with no-recent-activity + frequencies: + - hourly: + hour: 6 + filters: + - isPullRequest + - isOpen + - hasLabel: + label: no-recent-activity + - noActivitySince: + days: 14 + actions: + - addReply: + reply: This pull request will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days. + - closeIssue + - description: Close inactive Draft PRs + frequencies: + - hourly: + hour: 6 + filters: + - isDraftPullRequest + - isOpen + - noActivitySince: + days: 30 + actions: + - closeIssue + - addReply: + reply: Draft Pull Request was automatically closed for 30 days of inactivity. Please [let us know](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you'd like to reopen it. + eventResponderTasks: + - if: + - payloadType: Pull_Request + then: + - inPrLabel: + label: in-pr + description: Add `in-pr` label on issue when an open pull request is targeting it + - if: + - payloadType: Pull_Request + - isAction: + action: Opened + - not: + activitySenderHasPermission: + permission: Read + then: + - assignTo: + author: True + description: Assign Team PRs to author + - if: + - payloadType: Pull_Request + - isAction: + action: Opened + - and: + - not: + activitySenderHasPermission: + permission: Admin + - not: + activitySenderHasPermission: + permission: Write + - not: + activitySenderHasPermission: + permission: Write + - not: + isActivitySender: + user: github-actions[bot] + issueAuthor: False + - not: + isActivitySender: + user: dotnet-maestro[bot] + issueAuthor: False + - not: + isActivitySender: + user: dotnet-maestro-bot[bot] + issueAuthor: False + - not: + isActivitySender: + user: dotnet-maestro-bot + issueAuthor: False + - not: + isActivitySender: + user: dotnet-maestro + issueAuthor: False + - not: + isActivitySender: + user: github-actions + issueAuthor: False + then: + - addLabel: + label: community-contribution + description: Label community PRs + - if: + - payloadType: Issues + - labelAdded: + label: needs-author-action + then: + - addReply: + reply: This issue has been marked `needs-author-action` and may be missing some important information. + description: Needs-author-action notification + - if: + - payloadType: Pull_Request_Review + - not: + activitySenderHasPermission: + permission: Read + - isAction: + action: Submitted + - isReviewState: + reviewState: Changes_requested + then: + - addLabel: + label: needs-author-action + description: PR reviews with "changes requested" applies the needs-author-action label + - if: + - payloadType: Issue_Comment + - isAction: + action: Created + - isActivitySender: + issueAuthor: True + - hasLabel: + label: needs-author-action + - not: + hasLabel: + label: untriaged + - isOpen + then: + - addLabel: + label: needs-further-triage + - removeLabel: + label: needs-author-action + description: Replace `needs-author-action` label with `needs-further-triage` label when the author comments on an issue that is not still untriaged + - if: + - payloadType: Issue_Comment + - isAction: + action: Created + - isActivitySender: + issueAuthor: True + - hasLabel: + label: needs-author-action + - hasLabel: + label: untriaged + - isOpen + then: + - removeLabel: + label: needs-author-action + description: Remove `needs-author-action` label when the author comments on an `untriaged` issue + - if: + - payloadType: Pull_Request + - isAction: + action: Synchronize + - hasLabel: + label: needs-author-action + then: + - removeLabel: + label: needs-author-action + description: Pushing changes to PR branch removes the needs-author-action label + - if: + - payloadType: Issue_Comment + - isActivitySender: + issueAuthor: True + - isAction: + action: Created + - hasLabel: + label: needs-author-action + - isOpen + then: + - removeLabel: + label: needs-author-action + description: Author commenting in PR removes the needs-author-action label + - if: + - payloadType: Pull_Request_Review + - isActivitySender: + issueAuthor: True + - hasLabel: + label: needs-author-action + - isAction: + action: Submitted + - isOpen + then: + - removeLabel: + label: needs-author-action + description: Author responding to a pull request review comment removes the needs-author-action label + - if: + - payloadType: Issues + - not: + isAction: + action: Closed + - hasLabel: + label: no-recent-activity + - not: + labelAdded: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity + description: Remove `no-recent-activity` label from issues when issue is modified + - if: + - payloadType: Issue_Comment + - hasLabel: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity + description: Remove `no-recent-activity` label when an issue is commented on + - if: + - payloadType: Pull_Request + - isOpen + - hasLabel: + label: no-recent-activity + - not: + labelAdded: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity + description: Remove `no-recent-activity` label from PRs when modified + - if: + - payloadType: Issue_Comment + - hasLabel: + label: no-recent-activity + - isOpen + then: + - removeLabel: + label: no-recent-activity + description: Remove `no-recent-activity` label from PRs when commented on + - if: + - payloadType: Pull_Request_Review + - hasLabel: + label: no-recent-activity + - isOpen + then: + - removeLabel: + label: no-recent-activity + description: Remove `no-recent-activity` label from PRs when new review is added +onFailure: +onSuccess: From bd8c326bcb33979abe9a575c7ab5f24bdc6138f5 Mon Sep 17 00:00:00 2001 From: "dotnet-policy-service[bot]" <123482357+dotnet-policy-service[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 19:26:17 +0000 Subject: [PATCH 2/4] Deleting fabricbot.json --- .github/fabricbot.json | 1470 ---------------------------------------- 1 file changed, 1470 deletions(-) delete mode 100644 .github/fabricbot.json diff --git a/.github/fabricbot.json b/.github/fabricbot.json deleted file mode 100644 index d62d1d1ab2..0000000000 --- a/.github/fabricbot.json +++ /dev/null @@ -1,1470 +0,0 @@ -[ - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "taskName": "Add untriaged label to new/reopened issues without a milestone", - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "untriaged" - } - } - ], - "eventType": "issue", - "eventNames": [ - "issues" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "operator": "or", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "opened" - } - }, - { - "name": "isAction", - "parameters": { - "action": "reopened" - } - }, - { - "name": "removedFromMilestone", - "parameters": {} - } - ] - }, - { - "name": "isOpen", - "parameters": {} - }, - { - "operator": "not", - "operands": [ - { - "name": "isInMilestone", - "parameters": {} - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "untriaged" - } - } - ] - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "taskName": "Remove untriaged label from issues when closed or added to a milestone", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "untriaged" - } - } - ], - "eventType": "issue", - "eventNames": [ - "issues" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "operator": "or", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - }, - { - "name": "addedToMilestone", - "parameters": {} - } - ] - }, - { - "name": "hasLabel", - "parameters": { - "label": "untriaged" - } - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "InPrLabel", - "subCapability": "InPrLabel", - "version": "1.0", - "config": { - "taskName": "Add `in-pr` label on issue when an open pull request is targeting it", - "inPrLabelText": "There is an active PR which will close this issue when it is merged", - "fixedLabelEnabled": false, - "label_inPr": "in-pr" - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "taskName": "Assign Team PRs to author", - "actions": [ - { - "name": "assignToUser", - "parameters": { - "user": { - "type": "prAuthor" - } - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "opened" - } - }, - { - "operator": "not", - "operands": [ - { - "name": "activitySenderHasPermissions", - "parameters": { - "permissions": "read" - } - } - ] - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "taskName": "Label community PRs", - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "community-contribution" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "opened" - } - }, - { - "operator": "and", - "operands": [ - { - "operator": "not", - "operands": [ - { - "name": "activitySenderHasPermissions", - "parameters": { - "permissions": "admin" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "activitySenderHasPermissions", - "parameters": { - "permissions": "maintain" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "activitySenderHasPermissions", - "parameters": { - "permissions": "write" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": "github-actions[bot]" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": "dotnet-maestro[bot]" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": "dotnet-maestro-bot[bot]" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": "dotnet-maestro-bot" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": "dotnet-maestro" - } - } - ] - }, - { - "operator": "not", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": "github-actions" - } - } - ] - } - ] - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "taskName": "Needs-author-action notification", - "actions": [ - { - "name": "addReply", - "parameters": { - "comment": "This issue has been marked `needs-author-action` and may be missing some important information." - } - } - ], - "eventType": "issue", - "eventNames": [ - "issues" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "labelAdded", - "parameters": { - "label": "needs-author-action" - } - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestReviewResponder", - "version": "1.0", - "config": { - "taskName": "PR reviews with \"changes requested\" applies the needs-author-action label", - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "needs-author-action" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request_review" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "operator": "not", - "operands": [ - { - "name": "activitySenderHasPermissions", - "parameters": { - "state": "changes_requested", - "permissions": "read" - } - } - ] - }, - { - "name": "isAction", - "parameters": { - "action": "submitted" - } - }, - { - "name": "isReviewState", - "parameters": { - "state": "changes_requested" - } - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssueCommentResponder", - "version": "1.0", - "config": { - "taskName": "Replace `needs-author-action` label with `needs-further-triage` label when the author comments on an issue that is not still untriaged", - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "needs-further-triage" - } - }, - { - "name": "removeLabel", - "parameters": { - "label": "needs-author-action" - } - } - ], - "eventType": "issue", - "eventNames": [ - "issue_comment" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "created" - } - }, - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - }, - { - "operator": "not", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "untriaged" - } - } - ] - }, - { - "name": "isOpen", - "parameters": {} - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssueCommentResponder", - "version": "1.0", - "config": { - "taskName": "Remove `needs-author-action` label when the author comments on an `untriaged` issue", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "needs-author-action" - } - } - ], - "eventType": "issue", - "eventNames": [ - "issue_comment" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "created" - } - }, - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "untriaged" - } - }, - { - "name": "isOpen", - "parameters": {} - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "taskName": "Pushing changes to PR branch removes the needs-author-action label", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "needs-author-action" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "synchronize" - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestCommentResponder", - "version": "1.0", - "config": { - "taskName": "Author commenting in PR removes the needs-author-action label", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "needs-author-action" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "issue_comment" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "isAction", - "parameters": { - "action": "created" - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - }, - { - "name": "isOpen", - "parameters": {} - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestReviewResponder", - "version": "1.0", - "config": { - "taskName": "Author responding to a pull request review comment removes the needs-author-action label", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "needs-author-action" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request_review" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - }, - { - "name": "isAction", - "parameters": { - "action": "submitted" - } - }, - { - "name": "isOpen", - "parameters": {} - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Add no-recent-activity label to issues", - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "name": "addReply", - "parameters": { - "comment": "This issue has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." - } - } - ], - "frequency": [ - { - "weekDay": 0, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 1, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 2, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 3, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 4, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 5, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 6, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - } - ], - "searchTerms": [ - { - "name": "isIssue", - "parameters": {} - }, - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - }, - { - "name": "noActivitySince", - "parameters": { - "days": 14 - } - }, - { - "name": "noLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ] - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Add no-recent-activity label to PRs", - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "name": "addReply", - "parameters": { - "comment": "This pull request has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." - } - } - ], - "frequency": [ - { - "weekDay": 0, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 1, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 2, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 3, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 4, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 5, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - }, - { - "weekDay": 6, - "hours": [ - 4, - 10, - 16, - 22 - ], - "timezoneOffset": 1 - } - ], - "searchTerms": [ - { - "name": "isPr", - "parameters": {} - }, - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "needs-author-action" - } - }, - { - "name": "noActivitySince", - "parameters": { - "days": 14 - } - }, - { - "name": "noLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ] - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "taskName": "Remove `no-recent-activity` label from issues when issue is modified", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ], - "eventType": "issue", - "eventNames": [ - "issues" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "operator": "not", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "operator": "not", - "operands": [ - { - "name": "labelAdded", - "parameters": { - "label": "no-recent-activity" - } - } - ] - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssueCommentResponder", - "version": "1.0", - "config": { - "taskName": "Remove `no-recent-activity` label when an issue is commented on", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ], - "eventType": "issue", - "eventNames": [ - "issue_comment" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "taskName": "Remove `no-recent-activity` label from PRs when modified", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "operator": "not", - "operands": [ - { - "name": "labelAdded", - "parameters": { - "label": "no-recent-activity" - } - } - ] - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestCommentResponder", - "version": "1.0", - "config": { - "taskName": "Remove `no-recent-activity` label from PRs when commented on", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "issue_comment" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "name": "isOpen", - "parameters": {} - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestReviewResponder", - "version": "1.0", - "config": { - "taskName": "Remove `no-recent-activity` label from PRs when new review is added", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request_review" - ], - "conditions": { - "operator": "and", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "name": "isOpen", - "parameters": {} - } - ] - } - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Close issues with no recent activity", - "actions": [ - { - "name": "addReply", - "parameters": { - "comment": "This issue will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days." - } - }, - { - "name": "closeIssue", - "parameters": {} - } - ], - "frequency": [ - { - "weekDay": 0, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 1, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 2, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 3, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 4, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 5, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 6, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - } - ], - "searchTerms": [ - { - "name": "isIssue", - "parameters": {} - }, - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "name": "noActivitySince", - "parameters": { - "days": 14 - } - } - ] - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Close PRs with no-recent-activity", - "actions": [ - { - "name": "addReply", - "parameters": { - "comment": "This pull request will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days." - } - }, - { - "name": "closeIssue", - "parameters": {} - } - ], - "frequency": [ - { - "weekDay": 0, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 1, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 2, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 3, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 4, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 5, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 6, - "hours": [ - 0, - 6, - 12, - 18 - ], - "timezoneOffset": 0 - } - ], - "searchTerms": [ - { - "name": "isPr", - "parameters": {} - }, - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity" - } - }, - { - "name": "noActivitySince", - "parameters": { - "days": 14 - } - } - ] - } - }, - { - "taskSource": "fabricbot-config", - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Close inactive Draft PRs", - "actions": [ - { - "name": "closeIssue", - "parameters": {} - }, - { - "name": "addReply", - "parameters": { - "comment": "Draft Pull Request was automatically closed for 30 days of inactivity. Please [let us know](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you'd like to reopen it." - } - } - ], - "frequency": [ - { - "weekDay": 0, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 1, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 2, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 3, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 4, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 5, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 6, - "hours": [ - 5, - 11, - 17, - 23 - ], - "timezoneOffset": 0 - } - ], - "searchTerms": [ - { - "name": "isDraftPr", - "parameters": { - "value": "true" - } - }, - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "noActivitySince", - "parameters": { - "days": 30 - } - } - ] - } - } -] \ No newline at end of file From cd0119e7202239c5ddd8995e9c25f758c6725c4f Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Thu, 8 Feb 2024 17:26:17 -0800 Subject: [PATCH 3/4] De-Dupe the Write permission check --- .github/policies/resourceManagement.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml index 1056aacbe4..a6ab6f9dc8 100644 --- a/.github/policies/resourceManagement.yml +++ b/.github/policies/resourceManagement.yml @@ -116,9 +116,6 @@ configuration: - not: activitySenderHasPermission: permission: Write - - not: - activitySenderHasPermission: - permission: Write - not: isActivitySender: user: github-actions[bot] @@ -290,4 +287,4 @@ configuration: label: no-recent-activity description: Remove `no-recent-activity` label from PRs when new review is added onFailure: -onSuccess: +onSuccess: From dc6d50bb8fd4361d1bcfb1752fb4d3790f84264a Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 9 Feb 2024 16:44:58 -0800 Subject: [PATCH 4/4] Add automation for adding/removing the untriaged label to issues --- .github/policies/untriaged.yml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/policies/untriaged.yml diff --git a/.github/policies/untriaged.yml b/.github/policies/untriaged.yml new file mode 100644 index 0000000000..778539e1c5 --- /dev/null +++ b/.github/policies/untriaged.yml @@ -0,0 +1,39 @@ +id: untriaged +name: GitOps.PullRequestIssueManagement +description: Manage the 'untriaged' label on issues +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - if: + - payloadType: Issues + - isOpen + - not: + isPartOfAnyMilestone + - or: + - isAction: + action: Opened + - isAction: + action: Reopened + - not: + hasLabel: + label: untriaged + then: + - addLabel: + label: untriaged + description: Add untriaged label to new/reopened issues without a milestone + - if: + - payloadType: Issues + - or: + - isAction: + action: Closed + - isPartOfAnyMilestone + - hasLabel: + label: untriaged + then: + - removeLabel: + label: untriaged + description: Remove untriaged label from issues when closed or added to a milestone