mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[CI] Paginate codeowner comments to make sure we find it (#9818)
This commit is contained in:
		
							
								
								
									
										17
									
								
								.github/workflows/issue-codeowner-notify.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/issue-codeowner-notify.yml
									
									
									
									
										vendored
									
									
								
							| @@ -29,6 +29,9 @@ jobs: | |||||||
|  |  | ||||||
|             console.log(`Processing issue #${issue_number} with label: ${labelName}`); |             console.log(`Processing issue #${issue_number} with label: ${labelName}`); | ||||||
|  |  | ||||||
|  |             // Hidden marker to identify bot comments from this workflow | ||||||
|  |             const BOT_COMMENT_MARKER = '<!-- issue-codeowner-notify-bot -->'; | ||||||
|  |  | ||||||
|             // Extract component name from label |             // Extract component name from label | ||||||
|             const componentName = labelName.replace('component: ', ''); |             const componentName = labelName.replace('component: ', ''); | ||||||
|             console.log(`Component: ${componentName}`); |             console.log(`Component: ${componentName}`); | ||||||
| @@ -93,11 +96,14 @@ jobs: | |||||||
|               ); |               ); | ||||||
|  |  | ||||||
|               // Check for previous comments from this workflow to avoid duplicate pings |               // Check for previous comments from this workflow to avoid duplicate pings | ||||||
|               const { data: comments } = await github.rest.issues.listComments({ |               const comments = await github.paginate( | ||||||
|  |                 github.rest.issues.listComments, | ||||||
|  |                 { | ||||||
|                   owner, |                   owner, | ||||||
|                   repo, |                   repo, | ||||||
|                   issue_number: issue_number |                   issue_number: issue_number | ||||||
|               }); |                 } | ||||||
|  |               ); | ||||||
|  |  | ||||||
|               const previouslyPingedUsers = new Set(); |               const previouslyPingedUsers = new Set(); | ||||||
|               const previouslyPingedTeams = new Set(); |               const previouslyPingedTeams = new Set(); | ||||||
| @@ -105,9 +111,8 @@ jobs: | |||||||
|               // Look for comments from github-actions bot that contain codeowner pings for this component |               // Look for comments from github-actions bot that contain codeowner pings for this component | ||||||
|               const workflowComments = comments.filter(comment => |               const workflowComments = comments.filter(comment => | ||||||
|                 comment.user.type === 'Bot' && |                 comment.user.type === 'Bot' && | ||||||
|                 comment.user.login === 'github-actions[bot]' && |                 comment.body.includes(BOT_COMMENT_MARKER) && | ||||||
|                 comment.body.includes(`component: ${componentName}`) && |                 comment.body.includes(`component: ${componentName}`) | ||||||
|                 comment.body.includes("you've been identified as a codeowner") |  | ||||||
|               ); |               ); | ||||||
|  |  | ||||||
|               // Extract previously mentioned users and teams from workflow comments |               // Extract previously mentioned users and teams from workflow comments | ||||||
| @@ -140,7 +145,7 @@ jobs: | |||||||
|  |  | ||||||
|               // Create comment body |               // Create comment body | ||||||
|               const mentionString = allMentions.join(', '); |               const mentionString = allMentions.join(', '); | ||||||
|               const commentBody = `👋 Hey ${mentionString}!\n\nThis issue has been labeled with \`component: ${componentName}\` and you've been identified as a codeowner of this component. Please take a look when you have a chance!\n\nThanks for maintaining this component! 🙏`; |               const commentBody = `${BOT_COMMENT_MARKER}\n👋 Hey ${mentionString}!\n\nThis issue has been labeled with \`component: ${componentName}\` and you've been identified as a codeowner of this component. Please take a look when you have a chance!\n\nThanks for maintaining this component! 🙏`; | ||||||
|  |  | ||||||
|               // Post comment |               // Post comment | ||||||
|               await github.rest.issues.createComment({ |               await github.rest.issues.createComment({ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user