mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	[CI] Add `needs-docs` labelling (#9591)
				
					
				
			This commit is contained in:
		
							
								
								
									
										23
									
								
								.github/workflows/auto-label-pr.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								.github/workflows/auto-label-pr.yml
									
									
									
									
										vendored
									
									
								
							| @@ -4,7 +4,7 @@ on: | ||||
|   # Runs only on pull_request_target due to having access to a App token. | ||||
|   # This means PRs from forks will not be able to alter this workflow to get the tokens | ||||
|   pull_request_target: | ||||
|     types: [labeled, opened, reopened, synchronize] | ||||
|     types: [labeled, opened, reopened, synchronize, edited] | ||||
|  | ||||
| permissions: | ||||
|   pull-requests: write | ||||
| @@ -124,6 +124,7 @@ jobs: | ||||
|                 'by-code-owner', | ||||
|                 'has-tests', | ||||
|                 'needs-tests', | ||||
|                 'needs-docs', | ||||
|                 'too-big', | ||||
|                 'labeller-recheck' | ||||
|               ].includes(label) | ||||
| @@ -377,6 +378,26 @@ jobs: | ||||
|               } | ||||
|             } | ||||
|  | ||||
|             // Strategy: Documentation check for new components/platforms | ||||
|             if (labels.has('new-component') || labels.has('new-platform')) { | ||||
|               const prBody = context.payload.pull_request.body || ''; | ||||
|  | ||||
|               // Look for documentation PR links | ||||
|               // Patterns to match: | ||||
|               // - https://github.com/esphome/esphome-docs/pull/1234 | ||||
|               // - esphome/esphome-docs#1234 | ||||
|               const docsPrPatterns = [ | ||||
|                 /https:\/\/github\.com\/esphome\/esphome-docs\/pull\/\d+/, | ||||
|                 /esphome\/esphome-docs#\d+/ | ||||
|               ]; | ||||
|  | ||||
|               const hasDocsLink = docsPrPatterns.some(pattern => pattern.test(prBody)); | ||||
|  | ||||
|               if (!hasDocsLink) { | ||||
|                 labels.add('needs-docs'); | ||||
|               } | ||||
|             } | ||||
|  | ||||
|             // Convert Set to Array | ||||
|             let finalLabels = Array.from(labels); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user