mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Update repo maintenance rules
This commit is contained in:
		
							
								
								
									
										16
									
								
								.github/workflows/repo-maintenance.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/repo-maintenance.yml
									
									
									
									
										vendored
									
									
								
							| @@ -217,15 +217,20 @@ jobs: | ||||
|               return new Promise(resolve => setTimeout(resolve, ms)); | ||||
|             } | ||||
|  | ||||
|             const CUTOFF_MAX_COUNT = 80; | ||||
|             const CUTOFF_1_DAYS = 180; | ||||
|             const CUTOFF_1_COUNT = 5; | ||||
|             const CUTOFF_2_DAYS = 365; | ||||
|             const CUTOFF_2_COUNT = 10; | ||||
|             const CUTOFF_2_COUNT = 20; | ||||
|             const CUTOFF_3_DAYS = 730; | ||||
|             const CUTOFF_3_COUNT = 40; | ||||
|  | ||||
|             const cutoff1Date = new Date(); | ||||
|             cutoff1Date.setDate(cutoff1Date.getDate() - CUTOFF_1_DAYS); | ||||
|             const cutoff2Date = new Date(); | ||||
|             cutoff2Date.setDate(cutoff2Date.getDate() - CUTOFF_2_DAYS); | ||||
|             const cutoff3Date = new Date(); | ||||
|             cutoff3Date.setDate(cutoff3Date.getDate() - CUTOFF_3_DAYS); | ||||
|  | ||||
|             const query = `query( | ||||
|                 $owner:String!, | ||||
| @@ -255,9 +260,12 @@ jobs: | ||||
|             const result = await github.graphql(query, variables); | ||||
|  | ||||
|             for (const discussion of result.repository.discussions.nodes) { | ||||
|               const discussionDate = new Date(discussion.updatedAt); | ||||
|               if ((discussionDate < cutoff1Date && discussion.upvoteCount < CUTOFF_1_COUNT) || | ||||
|                   (discussionDate < cutoff2Date && discussion.upvoteCount < CUTOFF_2_COUNT)) { | ||||
|               const discussionUpdatedDate = new Date(discussion.updatedAt); | ||||
|               const discussionCreatedDate = new Date(discussion.createdAt); | ||||
|               if ((discussionUpdatedDate < cutoff1Date && discussion.upvoteCount < CUTOFF_MAX_COUNT) || | ||||
|                   (discussionCreatedDate < cutoff1Date && discussion.upvoteCount < CUTOFF_1_COUNT) || | ||||
|                   (discussionCreatedDate < cutoff2Date && discussion.upvoteCount < CUTOFF_2_COUNT) || | ||||
|                   (discussionCreatedDate < cutoff3Date && discussion.upvoteCount < CUTOFF_3_COUNT)) { | ||||
|                 console.log(`Closing discussion #${discussion.number} (${discussion.id}), last updated at ${discussion.updatedAt} with votes ${discussion.upvoteCount}`); | ||||
|                 const addCommentMutation = `mutation($discussion:ID!, $body:String!) { | ||||
|                   addDiscussionComment(input:{discussionId:$discussion, body:$body}) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon