1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00

Update changelog-pr.yml

This commit is contained in:
CanbiZ 2025-02-21 10:44:54 +01:00 committed by GitHub
parent 16b8bbfca6
commit d0cd58e923
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,9 +30,7 @@ jobs:
- name: Get latest dates in changelog
run: |
# Extrahiere die neuesten zwei Daten aus dem Changelog
DATES=$(grep -E '^## [0-9]{4}-[0-9]{2}-[0-9]{2}' CHANGELOG.md | head -n 2 | awk '{print $2}')
LATEST_DATE=$(echo "$DATES" | sed -n '1p')
SECOND_LATEST_DATE=$(echo "$DATES" | sed -n '2p')
TODAY=$(date -u +%Y-%m-%d)
@ -86,7 +84,7 @@ jobs:
});
if (!pulls || pulls.length === 0) {
console.log("⚠️ Keine gemergten PRs gefunden. Erzeuge leeres Changelog.");
console.log("⚠️ Keine gemergten PRs gefunden. Setze leeres Changelog.");
core.setOutput("result", "[]");
return;
}
@ -144,7 +142,7 @@ jobs:
});
core.setOutput("result", JSON.stringify(categorizedPRs.length ? categorizedPRs : []));
- name: Update CHANGELOG.md
uses: actions/github-script@v7
with:
@ -155,7 +153,11 @@ jobs:
const today = process.env.TODAY;
const latestDateInChangelog = process.env.LATEST_DATE;
const changelogPath = path.resolve('CHANGELOG.md');
const categorizedPRs = JSON.parse(process.env.RESULT);
const result = `${{ steps.get-categorized-prs.outputs.result }}`.trim();
console.log("🔹 Ergebnis aus get-categorized-prs:", result);
const categorizedPRs = result && result !== "undefined" ? JSON.parse(result) : [];
let newReleaseNotes = `## ${today}\n\n### Changes\n\n`;
for (const { title, notes } of categorizedPRs) {
@ -167,7 +169,6 @@ jobs:
const changelogContent = await fs.readFile(changelogPath, 'utf-8');
const changelogIncludesTodaysReleaseNotes = changelogContent.includes(`\n## ${today}`);
// Ersetze oder füge Release Notes ein
const regex = changelogIncludesTodaysReleaseNotes
? new RegExp(`## ${today}.*(?=## ${latestDateInChangelog})`, "gs")
: new RegExp(`(?=## ${latestDateInChangelog})`, "gs");