mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	Update changelog-pr.yml
This commit is contained in:
		
							
								
								
									
										111
									
								
								.github/workflows/changelog-pr.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										111
									
								
								.github/workflows/changelog-pr.yml
									
									
									
									
										vendored
									
									
								
							@@ -97,62 +97,71 @@ jobs:
 | 
			
		||||
                per_page: 100,
 | 
			
		||||
              });
 | 
			
		||||
 | 
			
		||||
            const filteredPRs = pulls.filter(pr =>
 | 
			
		||||
              pr.merged_at &&
 | 
			
		||||
              new Date(pr.merged_at) > latestDateInChangelog &&
 | 
			
		||||
              !pr.labels.some(label =>
 | 
			
		||||
                ["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL].includes(label.name.toLowerCase())
 | 
			
		||||
              )
 | 
			
		||||
            );
 | 
			
		||||
            
 | 
			
		||||
            for (const pr of filteredPRs) {
 | 
			
		||||
              const prLabels = pr.labels.map(label => label.name.toLowerCase());
 | 
			
		||||
              const filteredPRs = pulls.filter(pr =>
 | 
			
		||||
                pr.merged_at &&
 | 
			
		||||
                new Date(pr.merged_at) > latestDateInChangelog &&
 | 
			
		||||
                !pr.labels.some(label =>
 | 
			
		||||
                  ["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL].includes(label.name.toLowerCase())
 | 
			
		||||
                )
 | 
			
		||||
              );
 | 
			
		||||
              
 | 
			
		||||
              let prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
 | 
			
		||||
            
 | 
			
		||||
              if (pr.user.login === "push-app-to-main") {
 | 
			
		||||
                const scriptName = pr.title;
 | 
			
		||||
                if (scriptName) {
 | 
			
		||||
                  try {
 | 
			
		||||
                    const { data: relatedIssues } = await github.rest.issues.listForRepo({
 | 
			
		||||
                      owner: context.repo.owner,
 | 
			
		||||
                      repo: "ProxmoxVED", 
 | 
			
		||||
                      state: "all",
 | 
			
		||||
                      labels: ["Started Migration To ProxmoxVE"],  
 | 
			
		||||
                      per_page: 5
 | 
			
		||||
                    });                    
 | 
			
		||||
                    const matchingIssue = relatedIssues.find(issue => 
 | 
			
		||||
                      issue.title.toLowerCase().includes(scriptName.toLowerCase())
 | 
			
		||||
                    );
 | 
			
		||||
                    if (matchingIssue) {
 | 
			
		||||
                      const issueAuthor = matchingIssue.user.login;
 | 
			
		||||
                      const issueAuthorUrl = `https://github.com/${issueAuthor}`;
 | 
			
		||||
                      prNote = `- ${pr.title} [@${issueAuthor}](${issueAuthorUrl}) ([#${pr.number}](${pr.html_url}))`;
 | 
			
		||||
              for (const pr of filteredPRs) {
 | 
			
		||||
                const prLabels = pr.labels.map(label => label.name.toLowerCase());
 | 
			
		||||
                
 | 
			
		||||
                let prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
 | 
			
		||||
              
 | 
			
		||||
                if (pr.user.login === "push-app-to-main") {
 | 
			
		||||
                  const scriptName = pr.title;
 | 
			
		||||
                  if (scriptName) {
 | 
			
		||||
                    try {
 | 
			
		||||
                      const { data: relatedIssues } = await github.rest.issues.listForRepo({
 | 
			
		||||
                        owner: context.repo.owner,
 | 
			
		||||
                        repo: "ProxmoxVED", 
 | 
			
		||||
                        state: "all",
 | 
			
		||||
                        labels: ["Started Migration To ProxmoxVE"],  
 | 
			
		||||
                        per_page: 5
 | 
			
		||||
                      });                    
 | 
			
		||||
                      const matchingIssue = relatedIssues.find(issue => 
 | 
			
		||||
                        issue.title.toLowerCase().includes(scriptName.toLowerCase())
 | 
			
		||||
                      );
 | 
			
		||||
                      if (matchingIssue) {
 | 
			
		||||
                        const issueAuthor = matchingIssue.user.login;
 | 
			
		||||
                        const issueAuthorUrl = `https://github.com/${issueAuthor}`;
 | 
			
		||||
                        prNote = `- ${pr.title} [@${issueAuthor}](${issueAuthorUrl}) ([#${pr.number}](${pr.html_url}))`;
 | 
			
		||||
                      }
 | 
			
		||||
                    } catch (error) {
 | 
			
		||||
                      console.error(`Error fetching related issues: ${error}`);
 | 
			
		||||
                    }
 | 
			
		||||
                  } catch (error) {
 | 
			
		||||
                    console.error(`Error fetching related issues: ${error}`);
 | 
			
		||||
                  }
 | 
			
		||||
                } else {
 | 
			
		||||
                  prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                const updateScriptsCategory = categorizedPRs.find(category =>
 | 
			
		||||
                  category.labels.some(label => prLabels.includes(label))
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                if (updateScriptsCategory) {
 | 
			
		||||
                  const subCategory = updateScriptsCategory.subCategories.find(sub =>
 | 
			
		||||
                    sub.labels.some(label => prLabels.includes(label))
 | 
			
		||||
                  );
 | 
			
		||||
 | 
			
		||||
                  if (subCategory) {
 | 
			
		||||
                    subCategory.notes.push(prNote);
 | 
			
		||||
                  } else {
 | 
			
		||||
                    updateScriptsCategory.notes.push(prNote);
 | 
			
		||||
                    prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                // Find matching category
 | 
			
		||||
                for (const category of categorizedPRs) {
 | 
			
		||||
                  if (category.labels.some(label => prLabels.includes(label))) {
 | 
			
		||||
                    // Check if PR belongs to a subcategory
 | 
			
		||||
                    if (category.subCategories && category.subCategories.length > 0) {
 | 
			
		||||
                      const subCategory = category.subCategories.find(sub => 
 | 
			
		||||
                        sub.labels.some(label => prLabels.includes(label))
 | 
			
		||||
                      );
 | 
			
		||||
                      
 | 
			
		||||
                      if (subCategory) {
 | 
			
		||||
                        subCategory.notes.push(prNote);
 | 
			
		||||
                      } else {
 | 
			
		||||
                        category.notes.push(prNote);
 | 
			
		||||
                      }
 | 
			
		||||
                    } else {
 | 
			
		||||
                      category.notes.push(prNote);
 | 
			
		||||
                    }
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              
 | 
			
		||||
              return categorizedPRs;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            return await main();
 | 
			
		||||
 | 
			
		||||
      - name: Update CHANGELOG.md
 | 
			
		||||
        uses: actions/github-script@v7
 | 
			
		||||
@@ -248,4 +257,4 @@ jobs:
 | 
			
		||||
          PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
 | 
			
		||||
          if [ -n "$PR_NUMBER" ]; then
 | 
			
		||||
            gh pr review $PR_NUMBER --approve
 | 
			
		||||
          fi
 | 
			
		||||
          fi
 | 
			
		||||
		Reference in New Issue
	
	Block a user