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:
parent
16b8bbfca6
commit
d0cd58e923
13
.github/workflows/changelog-pr.yml
vendored
13
.github/workflows/changelog-pr.yml
vendored
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user