mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[CI] Fix auto-label workflow - codeowners & listFiles (#9890)
This commit is contained in:
		
							
								
								
									
										19
									
								
								.github/workflows/auto-label-pr.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								.github/workflows/auto-label-pr.yml
									
									
									
									
										vendored
									
									
								
							| @@ -89,11 +89,15 @@ jobs: | |||||||
|             // Check for mega-PR early - if present, skip most automatic labeling |             // Check for mega-PR early - if present, skip most automatic labeling | ||||||
|             const isMegaPR = currentLabels.includes('mega-pr'); |             const isMegaPR = currentLabels.includes('mega-pr'); | ||||||
|  |  | ||||||
|             const { data: prFiles } = await github.rest.pulls.listFiles({ |             // Get all PR files with automatic pagination | ||||||
|               owner, |             const prFiles = await github.paginate( | ||||||
|               repo, |               github.rest.pulls.listFiles, | ||||||
|               pull_number: pr_number |               { | ||||||
|             }); |                 owner, | ||||||
|  |                 repo, | ||||||
|  |                 pull_number: pr_number | ||||||
|  |               } | ||||||
|  |             ); | ||||||
|  |  | ||||||
|             // Calculate data from PR files |             // Calculate data from PR files | ||||||
|             const changedFiles = prFiles.map(file => file.filename); |             const changedFiles = prFiles.map(file => file.filename); | ||||||
| @@ -298,9 +302,10 @@ jobs: | |||||||
|                     const dir = pattern.slice(0, -1); |                     const dir = pattern.slice(0, -1); | ||||||
|                     regex = new RegExp(`^${dir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`); |                     regex = new RegExp(`^${dir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`); | ||||||
|                   } else if (pattern.includes('*')) { |                   } else if (pattern.includes('*')) { | ||||||
|  |                     // First escape all regex special chars except *, then replace * with .* | ||||||
|                     const regexPattern = pattern |                     const regexPattern = pattern | ||||||
|                       .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') |                       .replace(/[.+?^${}()|[\]\\]/g, '\\$&') | ||||||
|                       .replace(/\\*/g, '.*'); |                       .replace(/\*/g, '.*'); | ||||||
|                     regex = new RegExp(`^${regexPattern}$`); |                     regex = new RegExp(`^${regexPattern}$`); | ||||||
|                   } else { |                   } else { | ||||||
|                     regex = new RegExp(`^${pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`); |                     regex = new RegExp(`^${pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user