mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	[gh] Update Changelog Workflow (#2621)
* Update Workflow * Update Workflow
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							bef3ccd164
						
					
				
				
					commit
					893bff1b59
				
			
							
								
								
									
										28
									
								
								.github/workflows/autolabeler.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/autolabeler.yml
									
									
									
									
										vendored
									
									
								
							@@ -32,8 +32,9 @@ jobs:
 | 
			
		||||
            const autolabelerConfig = JSON.parse(fileContent);
 | 
			
		||||
 | 
			
		||||
            const prNumber = context.payload.pull_request.number;
 | 
			
		||||
            const prBody = context.payload.pull_request.body;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            const prBody = context.payload.pull_request.body.toLowerCase();
 | 
			
		||||
 | 
			
		||||
            let labelsToAdd = new Set();
 | 
			
		||||
 | 
			
		||||
            const prListFilesResponse = await github.rest.pulls.listFiles({
 | 
			
		||||
@@ -42,14 +43,35 @@ jobs:
 | 
			
		||||
              pull_number: prNumber,
 | 
			
		||||
            });
 | 
			
		||||
            const prFiles = prListFilesResponse.data;
 | 
			
		||||
           
 | 
			
		||||
            const templateLabelMappings = {
 | 
			
		||||
              "🐞 **bug fix**": "bugfix",
 | 
			
		||||
              "✨ **new feature**": "feature",
 | 
			
		||||
              "💥 **breaking change**": "breaking change",
 | 
			
		||||
              "🆕 **new script**": "new script"
 | 
			
		||||
            };
 | 
			
		||||
            
 | 
			
		||||
            for (const [checkbox, label] of Object.entries(templateLabelMappings)) {
 | 
			
		||||
              const escapedCheckbox = checkbox.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
 | 
			
		||||
              const regex = new RegExp(`- \\[(x|X)\\]\\s*.*${escapedCheckbox}`, "i");
 | 
			
		||||
              const match = prBody.match(regex);              
 | 
			
		||||
              if (match) {
 | 
			
		||||
                console.log(`Match: ${match}`);
 | 
			
		||||
                labelsToAdd.add(label);
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
            if (labelsToAdd.size === 0) {
 | 
			
		||||
              labelsToAdd.add("general");
 | 
			
		||||
            } 
 | 
			
		||||
 | 
			
		||||
            // Apply labels based on file changes
 | 
			
		||||
            for (const [label, rules] of Object.entries(autolabelerConfig)) {
 | 
			
		||||
              const shouldAddLabel = prFiles.some((prFile) => {
 | 
			
		||||
                return rules.some((rule) => {
 | 
			
		||||
                  const isFileStatusMatch = rule.fileStatus ? rule.fileStatus === prFile.status : true;
 | 
			
		||||
                  const isIncludeGlobMatch = rule.includeGlobs.some((glob) => minimatch(prFile.filename, glob));
 | 
			
		||||
                  const isExcludeGlobMatch = rule.excludeGlobs.some((glob) => minimatch(prFile.filename, glob));
 | 
			
		||||
                  
 | 
			
		||||
 | 
			
		||||
                  return isFileStatusMatch && isIncludeGlobMatch && !isExcludeGlobMatch;
 | 
			
		||||
                });
 | 
			
		||||
              });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user