Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding automation policies #599

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/policies/issue.add-no-recent-activity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Add no recent activity
description: Takes action to handle issues with no recent activity
resource: repository
configuration:
resourceManagementConfiguration:
scheduledSearches:
- description: Add no recent activity label to issues
frequencies:
- hourly:
hour: 3
filters:
- isIssue
- isOpen
- hasLabel:
label: 'Needs: Author Feedback'
- noActivitySince:
days: 4
- isNotLabeledWith:
label: no-recent-activity
actions:
- addLabel:
label: no-recent-activity
- addReply:
reply: |-
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.

If you are not the original author (${issueAuthor}) and believe this issue is not stale, please comment with `/bot not-stale` and I will not close it.
onFailure:
onSuccess:
23 changes: 23 additions & 0 deletions .github/policies/issue.close-duplicate-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Close duplicate issues
description: Close duplicate issues
resource: repository
configuration:
resourceManagementConfiguration:
scheduledSearches:
- description: Close duplicate issues
frequencies:
- hourly:
hour: 3
filters:
- isIssue
- isOpen
- hasLabel:
label: duplicate
- noActivitySince:
days: 3
actions:
- addReply:
reply: This issue has been marked as duplicate and has not had any activity for **3 days**. It will be closed for housekeeping purposes.
- closeIssue
onFailure:
onSuccess:
25 changes: 25 additions & 0 deletions .github/policies/issue.close-stale-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Close stale issues
description: Action to handle stale issues
resource: repository
configuration:
resourceManagementConfiguration:
scheduledSearches:
- description: Close stale issues
frequencies:
- hourly:
hour: 3
filters:
- isIssue
- isOpen
- hasLabel:
label: 'Needs: Author Feedback'
- hasLabel:
label: no-recent-activity
- noActivitySince:
days: 3
- isNotLabeledWith:
label: 'bot: do not close'
actions:
- closeIssue
onFailure:
onSuccess:
52 changes: 52 additions & 0 deletions .github/policies/issue.flag-for-triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Flag for triage
description: Add triage labels and default assignments to issues
resource: repository
configuration:
resourceManagementConfiguration:
eventResponderTasks:

- description: Add needs triage label to new issues
if:
- payloadType: Issues
- and:
- isAction:
action: Opened
- not:
isAssignedToSomeone
then:
- addLabel:
label: 'Needs: Triage (Functions)'

- description: Add needs attention label to reopened issues
if:
- payloadType: Issues
- and:
- isAction:
action: Reopened
- not:
hasLabel: 'Needs: Attention :wave:'
then:
- addLabel:
label: 'Needs: Attention :wave:'

- description: Assign issues when marked for triage or when attention needed again
if:
- payloadType: Issues
- isAction:
action: Labeled
- not:
isAssignedToSomeone
- or:
- labelAdded:
label: 'Needs: Triage (Functions)'
- labelAdded:
label: 'Needs: Attention :wave:'
then:
- assignIcmUsers:
teamId: 114785
primary: true
secondary: false
triggerOnOwnActions: true

onFailure:
onSuccess:
33 changes: 33 additions & 0 deletions .github/policies/issue.prevent-auto-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Prevent auto-close
description: Prevents issue from being closed by the automation
resource: repository
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: Prevents issue from being closed by the automation
if:
- payloadType: Issue_Comment
- or :
- isAction:
action: Created
- isAction:
action: Edited
- commentContains:
pattern: /bot not-stale
isRegex: False
- and:
- hasLabel:
label: 'Needs: Author Feedback'
- hasLabel:
label: no-recent-activity
- not:
hasLabel: 'bot: do not close'
then:
- addLabel:
label: 'bot: do not close'
- addLabel:
label: 'Needs: Attention :wave:'
- addReply:
reply: Thank you ${contextualAuthor}. This issue will not be automatically closed and a member of the team will review it soon.
onFailure:
onSuccess:
25 changes: 25 additions & 0 deletions .github/policies/issue.remove-needs-author-feedback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Remove needs author feedback label.
description: Remove needs author feedback label and adds needs attention
resource: repository
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: Remove needs author feedback label. Add needs attention
if:
- payloadType: Issue_Comment
- isAction:
action: Created
- isActivitySender:
issueAuthor: True
- hasLabel:
label: 'Needs: Author Feedback'
then:
- if:
- isOpen
then:
- addLabel:
label: 'Needs: Attention :wave:'
- removeLabel:
label: 'Needs: Author Feedback'
onFailure:
onSuccess:
45 changes: 45 additions & 0 deletions .github/policies/issue.remove-needs-triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Remove triage labels on close
description: Removes "needs:*" labels from closed issues
resource: repository
configuration:
resourceManagementConfiguration:
eventResponderTasks:

- description: Remove needs triage label from closed issues
if:
- payloadType: Issues
- isAction:
action: Closed
- hasLabel:
label: 'Needs: Triage (Functions)'
then:
- removeLabel:
label: 'Needs: Triage (Functions)'
triggerOnOwnActions: true

- description: Remove needs attention label from closed issues
if:
- payloadType: Issues
- isAction:
action: Closed
- hasLabel:
label: 'Needs: Attention :wave:'
then:
- removeLabel:
label: 'Needs: Attention :wave:'
triggerOnOwnActions: true

- description: Remove needs author feedback label from closed issues
if:
- payloadType: Issues
- isAction:
action: Closed
- hasLabel:
label: 'Needs: Author Feedback'
then:
- removeLabel:
label: 'Needs: Author Feedback'
triggerOnOwnActions: true

onFailure:
onSuccess:
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Remove no recent activity label
description: Remove no recent activity label when issue is commented on
resource: repository
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: Remove no recent activity label when issue is commented on
if:
- payloadType: Issue_Comment
- isAction:
action: Created
- hasLabel:
label: no-recent-activity
then:
- removeLabel:
label: no-recent-activity
onFailure:
onSuccess:
Loading