mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-19 16:28:07 +00:00
Update changelog-pr.yml
This commit is contained in:
parent
37b7894504
commit
4fd8e265f2
34
.github/workflows/changelog-pr.yml
vendored
34
.github/workflows/changelog-pr.yml
vendored
@ -97,15 +97,19 @@ jobs:
|
|||||||
per_page: 100,
|
per_page: 100,
|
||||||
});
|
});
|
||||||
|
|
||||||
pulls.filter(pr =>
|
const filteredPRs = pulls.filter(pr =>
|
||||||
pr.merged_at &&
|
pr.merged_at &&
|
||||||
new Date(pr.merged_at) > latestDateInChangelog &&
|
new Date(pr.merged_at) > latestDateInChangelog &&
|
||||||
!pr.labels.some(label =>
|
!pr.labels.some(label =>
|
||||||
["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL].includes(label.name.toLowerCase())
|
["invalid", "wontdo", process.env.AUTOMATED_PR_LABEL].includes(label.name.toLowerCase())
|
||||||
)
|
)
|
||||||
).forEach(pr => {
|
);
|
||||||
|
|
||||||
|
for (const pr of filteredPRs) { // ✅ for...of unterstützt await
|
||||||
const prLabels = pr.labels.map(label => label.name.toLowerCase());
|
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") {
|
if (pr.user.login === "push-app-to-main") {
|
||||||
const scriptName = pr.title;
|
const scriptName = pr.title;
|
||||||
if (scriptName) {
|
if (scriptName) {
|
||||||
@ -114,7 +118,7 @@ jobs:
|
|||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: "ProxmoxVED",
|
repo: "ProxmoxVED",
|
||||||
state: "all",
|
state: "all",
|
||||||
label: "Started Migration To ProxmoxVE",
|
labels: ["Started Migration To ProxmoxVE"], // "label" -> "labels"
|
||||||
per_page: 5
|
per_page: 5
|
||||||
});
|
});
|
||||||
const matchingIssue = relatedIssues.find(issue =>
|
const matchingIssue = relatedIssues.find(issue =>
|
||||||
@ -123,26 +127,19 @@ jobs:
|
|||||||
if (matchingIssue) {
|
if (matchingIssue) {
|
||||||
const issueAuthor = matchingIssue.user.login;
|
const issueAuthor = matchingIssue.user.login;
|
||||||
const issueAuthorUrl = `https://github.com/${issueAuthor}`;
|
const issueAuthorUrl = `https://github.com/${issueAuthor}`;
|
||||||
const prNote = `- ${pr.title} [@${issueAuthor}](${issueAuthorUrl}) ([#${pr.number}](${pr.html_url}))`;
|
prNote = `- ${pr.title} [@${issueAuthor}](${issueAuthorUrl}) ([#${pr.number}](${pr.html_url}))`;
|
||||||
} else {
|
|
||||||
const prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error fetching related issues: ${error}`);
|
console.error(`Error fetching related issues: ${error}`);
|
||||||
const prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
const prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
|
}
|
||||||
|
|
||||||
}else{
|
|
||||||
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
|
|
||||||
}
|
|
||||||
const updateScriptsCategory = categorizedPRs.find(category =>
|
const updateScriptsCategory = categorizedPRs.find(category =>
|
||||||
category.labels.some(label => prLabels.includes(label))
|
category.labels.some(label => prLabels.includes(label))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (updateScriptsCategory) {
|
if (updateScriptsCategory) {
|
||||||
|
|
||||||
const subCategory = updateScriptsCategory.subCategories.find(sub =>
|
const subCategory = updateScriptsCategory.subCategories.find(sub =>
|
||||||
sub.labels.some(label => prLabels.includes(label))
|
sub.labels.some(label => prLabels.includes(label))
|
||||||
);
|
);
|
||||||
@ -153,15 +150,7 @@ jobs:
|
|||||||
updateScriptsCategory.notes.push(prNote);
|
updateScriptsCategory.notes.push(prNote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
console.log(JSON.stringify(categorizedPRs, null, 2));
|
|
||||||
|
|
||||||
return categorizedPRs;
|
|
||||||
}
|
}
|
||||||
main().catch(error => {
|
|
||||||
console.error("Error in script:", error);
|
|
||||||
});
|
|
||||||
|
|
||||||
- name: Update CHANGELOG.md
|
- name: Update CHANGELOG.md
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
@ -184,8 +173,6 @@ jobs:
|
|||||||
const hasMainNotes = notes.length > 0;
|
const hasMainNotes = notes.length > 0;
|
||||||
const hasSubNotes = hasSubcategories && subCategories.some(sub => sub.notes && sub.notes.length > 0);
|
const hasSubNotes = hasSubcategories && subCategories.some(sub => sub.notes && sub.notes.length > 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (hasMainNotes || hasSubNotes) {
|
if (hasMainNotes || hasSubNotes) {
|
||||||
newReleaseNotes += `### ${title}\n\n`;
|
newReleaseNotes += `### ${title}\n\n`;
|
||||||
}
|
}
|
||||||
@ -202,7 +189,6 @@ jobs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const changelogContent = await fs.readFile(changelogPath, 'utf-8');
|
const changelogContent = await fs.readFile(changelogPath, 'utf-8');
|
||||||
const changelogIncludesTodaysReleaseNotes = changelogContent.includes(`\n## ${today}`);
|
const changelogIncludesTodaysReleaseNotes = changelogContent.includes(`\n## ${today}`);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user