Skip to content

Commit 211cf7d

Browse files
authored
Add the ability to manage Auto-Close on issues (#8546)
* Add the ability to manage Auto-Close on issues * Add the label to the common labels * Match the grey color
1 parent b7b5f95 commit 211cf7d

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/TriageLabelConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ public class TriageLabelConstants
2121
public const string NoRecentActivity = "no-recent-activity";
2222
public const string Question = "question";
2323
public const string ServiceAttention = "Service Attention";
24+
public const string AutoCloseExempt = "auto-close-exempt";
2425
}
2526
}

tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/ScheduledEventProcessing.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public static async Task CloseStaleIssues(GitHubEventClient gitHubEventClient, S
186186
TriageLabelConstants.NeedsAuthorFeedback,
187187
TriageLabelConstants.NoRecentActivity
188188
};
189+
189190
SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(scheduledEventPayload.Repository.Owner.Login,
190191
scheduledEventPayload.Repository.Name,
191192
IssueTypeQualifier.Issue,
@@ -574,6 +575,12 @@ public static async Task EnforceMaxLifeOfIssues(GitHubEventClient gitHubEventCli
574575
{
575576
int ScheduledTaskUpdateLimit = await gitHubEventClient.ComputeScheduledTaskUpdateLimit();
576577

578+
/// An issue with the auto-close-exempt label will exempt the issue from being closed by this rule
579+
List<string> excludeLabels = new List<string>
580+
{
581+
TriageLabelConstants.AutoCloseExempt
582+
};
583+
577584
SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(
578585
scheduledEventPayload.Repository.Owner.Login,
579586
scheduledEventPayload.Repository.Name,
@@ -582,7 +589,7 @@ public static async Task EnforceMaxLifeOfIssues(GitHubEventClient gitHubEventCli
582589
30, // more than 30 days
583590
new List<IssueIsQualifier> { IssueIsQualifier.Unlocked },
584591
null,
585-
null,
592+
excludeLabels,
586593
365*2 // Created date > 2 years
587594
);
588595

tools/github-event-processor/RULES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ OR
629629
- Issue is open
630630
- Issue was opened > 2 years ago
631631
- Issue was last updated more than 30 days ago
632+
- Issue does NOT have the auto-close-exempt label
632633

633634
### Actions
634635

tools/github/data/common-labels.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ VideoAnalyzer,Azure Video Analyzer,e99695
229229
Visual Studio,,e99695
230230
Web Apps,,e99695
231231
WebPubSub,,e99695
232+
auto-close-exempt,Prevents the auto-close from closing based on max lifetime,ededed
232233
blocking-release,Blocks release,d73a49
233234
breaking-change,,d73a49
234235
bug,This issue requires a change to an existing behavior in the product in order to be resolved.,eaa875

0 commit comments

Comments
 (0)