From 44d82dfbba67a2ee67f7f749ef28c1e902f2f1b2 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Fri, 8 Dec 2023 12:45:18 -0800 Subject: [PATCH 1/4] Add Resource Management automation for issue and PR Triage --- .../policies/labelManagement.issueOpened.yml | 22 +++++++++ .../policies/labelManagement.issueUpdated.yml | 30 +++++++++++++ .../policies/labelManagement.prUpdated.yml | 45 +++++++++++++++++++ ...scheduledSearch.closeStaleIssuesAndPrs.yml | 24 ++++++++++ .../scheduledSearch.markNoRecentActivity.yml | 30 +++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 .github/policies/labelManagement.issueOpened.yml create mode 100644 .github/policies/labelManagement.issueUpdated.yml create mode 100644 .github/policies/labelManagement.prUpdated.yml create mode 100644 .github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml create mode 100644 .github/policies/scheduledSearch.markNoRecentActivity.yml diff --git a/.github/policies/labelManagement.issueOpened.yml b/.github/policies/labelManagement.issueOpened.yml new file mode 100644 index 0000000000..3eac01c66b --- /dev/null +++ b/.github/policies/labelManagement.issueOpened.yml @@ -0,0 +1,22 @@ +name: New Issues +description: Adds untriaged label to new issues +resource: repository + +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: Add untriaged to new issues + if: + - payloadType: Issues + - isAction: + action: Opened + then: + - addLabel: + label: untriaged + - description: Add CodeFlow link to new PRs + if: + - payloadType: Pull_Request + - isAction: + action: Opened + then: + - addCodeFlowLink \ No newline at end of file diff --git a/.github/policies/labelManagement.issueUpdated.yml b/.github/policies/labelManagement.issueUpdated.yml new file mode 100644 index 0000000000..b4bf7e2854 --- /dev/null +++ b/.github/policies/labelManagement.issueUpdated.yml @@ -0,0 +1,30 @@ +name: Issue Activity Responder +description: Adds/Removes labels from issues based on activity +resource: repository + +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: Remove no-recent-activity label from issues after an update + if: + - or: + - payloadType: Issue_Comment + - payloadType: Issues + - not: + - isAction: + action: Closed + - hasLabel: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity + - description: Remove needs-author-action label from issues when an author replies + if: + - payloadType: Issue_Comment + - isActivitySender: + issueAuthor: true + - hasLabel: + label: needs-author-action + then: + - removeLabel: + label: needs-author-action \ No newline at end of file diff --git a/.github/policies/labelManagement.prUpdated.yml b/.github/policies/labelManagement.prUpdated.yml new file mode 100644 index 0000000000..0f5d8582e2 --- /dev/null +++ b/.github/policies/labelManagement.prUpdated.yml @@ -0,0 +1,45 @@ +name: PR Activity Responder +description: Adds/Removes labels from PRs based on activity +resource: repository + +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: Add needs-author-action label when changes are requested + if: + - payloadType: Pull_Request_Review + - isAction: + action: Submitted + - isReviewState: + state: Changes_requested + then: + - addLabel: + label: needs-author-action + - description: Remove needs-author-action label from PRs when an author updates the PR + if: + - or: + - payloadType: Pull_Request_Review + - payloadType: Pull_Request_Review_Comment + - not: + - isAction: + action: Closed + - isActivitySender: + issueAuthor: true + - hasLabel: + label: needs-author-action + then: + - removeLabel: + label: needs-author-action + - description: Remove no-recent-activity label from PRs after an update + if: + - or: + - payloadType: Pull_Request_Review + - payloadType: Pull_Request_Review_Comment + - not: + - isAction: + action: Closed + - hasLabel: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity \ No newline at end of file diff --git a/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml b/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml new file mode 100644 index 0000000000..68aa6fa281 --- /dev/null +++ b/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml @@ -0,0 +1,24 @@ +name: Close Stale Issues and PRs +description: Closes issues and PRs that have not been updated in a while +resource: repository + +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: Close issues and PRs that have not been updated in a while + frequencies: + - hourly: + hour: 12 + filters: + - or: + - isPullRequest + - isIssue + - isOpen + - hasLabel: + label: needs-author-action + - hasLabel: + label: no-recent-activity + - noActivitySince: + days: 7 + actions: + - closeIssue \ No newline at end of file diff --git a/.github/policies/scheduledSearch.markNoRecentActivity.yml b/.github/policies/scheduledSearch.markNoRecentActivity.yml new file mode 100644 index 0000000000..b30174e2c8 --- /dev/null +++ b/.github/policies/scheduledSearch.markNoRecentActivity.yml @@ -0,0 +1,30 @@ +name: No Recent Activity Monitor +description: Adds no-recent-activity label to issues and PRs that have not been updated in a while +resource: repository + +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: Add no-recent-activity label to issues and PRs that have not been updated in a while + frequencies: + - hourly: + hour: 3 + filters: + - or: + - isPullRequest + - isIssue + - isOpen + - isNotLabeledWith: + label: no-recent-activity + - hasLabel: + label: needs-author-action + - noActivitySince: + days: 14 + actions: + - addLabel: + label: no-recent-activity + - addReply: + reply: >- + This submission has been automatically marked as stale because it has been marked as requiring author action but has not had any activity for **14 days**. + + It will be closed if no further activity occurs **within 7 days of this comment**. \ No newline at end of file From dd2175ac63d4c4d880ccc32c9facf944cce8c7dc Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Fri, 8 Dec 2023 13:01:58 -0800 Subject: [PATCH 2/4] Add more meatadata to automation files. --- .github/policies/labelManagement.issueOpened.yml | 5 ++++- .github/policies/labelManagement.issueUpdated.yml | 5 ++++- .github/policies/labelManagement.prUpdated.yml | 5 ++++- .github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml | 5 ++++- .github/policies/scheduledSearch.markNoRecentActivity.yml | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/policies/labelManagement.issueOpened.yml b/.github/policies/labelManagement.issueOpened.yml index 3eac01c66b..9af61d9e30 100644 --- a/.github/policies/labelManagement.issueOpened.yml +++ b/.github/policies/labelManagement.issueOpened.yml @@ -1,7 +1,10 @@ +id: labelManagement.issueOpened name: New Issues description: Adds untriaged label to new issues +owner: resource: repository - +disabled: false +where: configuration: resourceManagementConfiguration: eventResponderTasks: diff --git a/.github/policies/labelManagement.issueUpdated.yml b/.github/policies/labelManagement.issueUpdated.yml index b4bf7e2854..6ec7f25cae 100644 --- a/.github/policies/labelManagement.issueUpdated.yml +++ b/.github/policies/labelManagement.issueUpdated.yml @@ -1,7 +1,10 @@ +id: labelManagement.issueUpdated name: Issue Activity Responder description: Adds/Removes labels from issues based on activity +owner: resource: repository - +disabled: false +where: configuration: resourceManagementConfiguration: eventResponderTasks: diff --git a/.github/policies/labelManagement.prUpdated.yml b/.github/policies/labelManagement.prUpdated.yml index 0f5d8582e2..368e4218a0 100644 --- a/.github/policies/labelManagement.prUpdated.yml +++ b/.github/policies/labelManagement.prUpdated.yml @@ -1,7 +1,10 @@ +id: labelManagement.prUpdated name: PR Activity Responder description: Adds/Removes labels from PRs based on activity +owner: resource: repository - +disabled: false +where: configuration: resourceManagementConfiguration: eventResponderTasks: diff --git a/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml b/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml index 68aa6fa281..4f99279408 100644 --- a/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml +++ b/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml @@ -1,7 +1,10 @@ +id: scheduledSearch.closeStaleIssuesAndPrs name: Close Stale Issues and PRs description: Closes issues and PRs that have not been updated in a while +owner: resource: repository - +disabled: false +where: configuration: resourceManagementConfiguration: scheduledSearches: diff --git a/.github/policies/scheduledSearch.markNoRecentActivity.yml b/.github/policies/scheduledSearch.markNoRecentActivity.yml index b30174e2c8..dae4b1d58a 100644 --- a/.github/policies/scheduledSearch.markNoRecentActivity.yml +++ b/.github/policies/scheduledSearch.markNoRecentActivity.yml @@ -1,7 +1,10 @@ +id: scheduledSearch.markNoRecentActivity name: No Recent Activity Monitor description: Adds no-recent-activity label to issues and PRs that have not been updated in a while +owner: resource: repository - +disabled: false +where: configuration: resourceManagementConfiguration: scheduledSearches: From 94320a3b3ef137b31ecde29517e39968f1e4bb1c Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Fri, 8 Dec 2023 13:05:24 -0800 Subject: [PATCH 3/4] Remove extra spaces --- .github/policies/labelManagement.issueOpened.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/policies/labelManagement.issueOpened.yml b/.github/policies/labelManagement.issueOpened.yml index 9af61d9e30..31356315b2 100644 --- a/.github/policies/labelManagement.issueOpened.yml +++ b/.github/policies/labelManagement.issueOpened.yml @@ -20,6 +20,6 @@ configuration: if: - payloadType: Pull_Request - isAction: - action: Opened + action: Opened then: - addCodeFlowLink \ No newline at end of file From a6349e93b40a81a440444797a4a5b42a1cf76c97 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Fri, 8 Dec 2023 15:13:11 -0800 Subject: [PATCH 4/4] Fix parsing issues with automation files --- .../policies/labelManagement.issueOpened.yml | 6 ++--- .../policies/labelManagement.issueUpdated.yml | 14 +++++----- .../policies/labelManagement.prUpdated.yml | 26 +++++++++---------- ...scheduledSearch.closeStaleIssuesAndPrs.yml | 11 +++----- .../scheduledSearch.markNoRecentActivity.yml | 19 ++++++-------- 5 files changed, 35 insertions(+), 41 deletions(-) diff --git a/.github/policies/labelManagement.issueOpened.yml b/.github/policies/labelManagement.issueOpened.yml index 31356315b2..b60af711ab 100644 --- a/.github/policies/labelManagement.issueOpened.yml +++ b/.github/policies/labelManagement.issueOpened.yml @@ -12,14 +12,14 @@ configuration: if: - payloadType: Issues - isAction: - action: Opened + action: Opened then: - addLabel: - label: untriaged + label: untriaged - description: Add CodeFlow link to new PRs if: - payloadType: Pull_Request - isAction: - action: Opened + action: Opened then: - addCodeFlowLink \ No newline at end of file diff --git a/.github/policies/labelManagement.issueUpdated.yml b/.github/policies/labelManagement.issueUpdated.yml index 6ec7f25cae..bafb4a7755 100644 --- a/.github/policies/labelManagement.issueUpdated.yml +++ b/.github/policies/labelManagement.issueUpdated.yml @@ -14,20 +14,20 @@ configuration: - payloadType: Issue_Comment - payloadType: Issues - not: - - isAction: - action: Closed + isAction: + action: Closed - hasLabel: - label: no-recent-activity + label: no-recent-activity then: - removeLabel: - label: no-recent-activity + label: no-recent-activity - description: Remove needs-author-action label from issues when an author replies if: - payloadType: Issue_Comment - isActivitySender: - issueAuthor: true + issueAuthor: true - hasLabel: - label: needs-author-action + label: needs-author-action then: - removeLabel: - label: needs-author-action \ No newline at end of file + label: needs-author-action \ No newline at end of file diff --git a/.github/policies/labelManagement.prUpdated.yml b/.github/policies/labelManagement.prUpdated.yml index 368e4218a0..a6539a6be6 100644 --- a/.github/policies/labelManagement.prUpdated.yml +++ b/.github/policies/labelManagement.prUpdated.yml @@ -12,37 +12,37 @@ configuration: if: - payloadType: Pull_Request_Review - isAction: - action: Submitted + action: Submitted - isReviewState: - state: Changes_requested + reviewState: Changes_requested then: - addLabel: - label: needs-author-action + label: needs-author-action - description: Remove needs-author-action label from PRs when an author updates the PR if: - or: - payloadType: Pull_Request_Review - payloadType: Pull_Request_Review_Comment - not: - - isAction: - action: Closed + isAction: + action: Closed - isActivitySender: - issueAuthor: true + issueAuthor: true - hasLabel: - label: needs-author-action + label: needs-author-action then: - removeLabel: - label: needs-author-action - - description: Remove no-recent-activity label from PRs after an update + label: needs-author-action + - description: Remove no-recent-activity label from PRs after an update if: - or: - payloadType: Pull_Request_Review - payloadType: Pull_Request_Review_Comment - not: - - isAction: - action: Closed + isAction: + action: Closed - hasLabel: - label: no-recent-activity + label: no-recent-activity then: - removeLabel: - label: no-recent-activity \ No newline at end of file + label: no-recent-activity \ No newline at end of file diff --git a/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml b/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml index 4f99279408..7586446eca 100644 --- a/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml +++ b/.github/policies/scheduledSearch.closeStaleIssuesAndPrs.yml @@ -11,17 +11,14 @@ configuration: - description: Close issues and PRs that have not been updated in a while frequencies: - hourly: - hour: 12 + hour: 12 filters: - - or: - - isPullRequest - - isIssue - isOpen - hasLabel: - label: needs-author-action + label: needs-author-action - hasLabel: - label: no-recent-activity + label: no-recent-activity - noActivitySince: - days: 7 + days: 7 actions: - closeIssue \ No newline at end of file diff --git a/.github/policies/scheduledSearch.markNoRecentActivity.yml b/.github/policies/scheduledSearch.markNoRecentActivity.yml index dae4b1d58a..72b6c166c1 100644 --- a/.github/policies/scheduledSearch.markNoRecentActivity.yml +++ b/.github/policies/scheduledSearch.markNoRecentActivity.yml @@ -11,23 +11,20 @@ configuration: - description: Add no-recent-activity label to issues and PRs that have not been updated in a while frequencies: - hourly: - hour: 3 + hour: 3 filters: - - or: - - isPullRequest - - isIssue - isOpen - isNotLabeledWith: - label: no-recent-activity + label: no-recent-activity - hasLabel: - label: needs-author-action + label: needs-author-action - noActivitySince: - days: 14 + days: 14 actions: - addLabel: - label: no-recent-activity + label: no-recent-activity - addReply: - reply: >- - This submission has been automatically marked as stale because it has been marked as requiring author action but has not had any activity for **14 days**. + reply: >- + This submission has been automatically marked as stale because it has been marked as requiring author action but has not had any activity for **14 days**. - It will be closed if no further activity occurs **within 7 days of this comment**. \ No newline at end of file + It will be closed if no further activity occurs **within 7 days of this comment**. \ No newline at end of file