8989
9090 const { data: pulls } = await github.rest.pulls.list({
9191 owner: context.repo.owner,
92- repo: context.repo.repo ,
92+ repo: "ProxmoxVE" ,
9393 base: "main",
9494 state: "closed",
9595 sort: "updated",
@@ -104,24 +104,24 @@ jobs:
104104 ["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL].includes(label.name.toLowerCase())
105105 )
106106 );
107-
107+
108108 for (const pr of filteredPRs) {
109109 const prLabels = pr.labels.map(label => label.name.toLowerCase());
110-
110+
111111 let prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
112-
113- if (pr.user.login === "push-app-to-main") {
112+
113+
114+ if (pr.user.login.includes("push-app-to-main[bot]")) {
114115 const scriptName = pr.title;
115- if (scriptName) {
116116 try {
117117 const { data: relatedIssues } = await github.rest.issues.listForRepo({
118118 owner: context.repo.owner,
119- repo: "ProxmoxVED",
119+ repo: "ProxmoxVED",
120120 state: "all",
121- labels: ["Started Migration To ProxmoxVE"],
121+ labels: ["Started Migration To ProxmoxVE"],
122122 per_page: 5
123- });
124- const matchingIssue = relatedIssues.find(issue =>
123+ });
124+ const matchingIssue = relatedIssues.find(issue =>
125125 issue.title.toLowerCase().includes(scriptName.toLowerCase())
126126 );
127127 if (matchingIssue) {
@@ -131,36 +131,48 @@ jobs:
131131 }
132132 } catch (error) {
133133 console.error(`Error fetching related issues: ${error}`);
134+ prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
134135 }
135- } else {
136- prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
137- }
138136 }
139-
140- // Find matching category
141- for (const category of categorizedPRs) {
137+
138+
139+
140+ if (prLabels.includes("new script")) {
141+ const newScriptCategory = categorizedPRs.find(category =>
142+ category.title === "New Scripts" || category.labels.includes("new script"));
143+ if (newScriptCategory) {
144+ newScriptCategory.notes.push(prNote);
145+ }
146+ } else {
147+
148+ let categorized = false;
149+ const priorityCategories = categorizedPRs.slice();
150+ for (const category of priorityCategories) {
151+ if (categorized) break;
142152 if (category.labels.some(label => prLabels.includes(label))) {
143- // Check if PR belongs to a subcategory
144153 if (category.subCategories && category.subCategories.length > 0) {
145- const subCategory = category.subCategories.find(sub =>
146- sub.labels.some(label => prLabels.includes(label))
147- );
148-
149- if (subCategory) {
150- subCategory.notes.push(prNote);
151- } else {
152- category.notes.push(prNote);
153- }
154+ const subCategory = category.subCategories.find(sub =>
155+ sub.labels.some(label => prLabels.includes(label))
156+ );
157+
158+ if (subCategory) {
159+ subCategory.notes.push(prNote);
154160 } else {
155161 category.notes.push(prNote);
156162 }
163+ } else {
164+ category.notes.push(prNote);
165+ }
166+ categorized = true;
167+ }
157168 }
158169 }
170+
159171 }
160-
172+
161173 return categorizedPRs;
162174 }
163-
175+
164176 return await main();
165177
166178 - name : Update CHANGELOG.md
0 commit comments