Files
CPLv4.0/scripts/updateChangelogFromCommit.js

18 lines
674 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const fs = require("fs");
const path = require("path");
const changelogPath = path.resolve("CHANGELOG.md");
const commitMsgPath = path.resolve(".git", "COMMIT_EDITMSG");
const packageJson = require("../package.json");
const commitMsg = fs.readFileSync(commitMsgPath, "utf-8").trim();
const version = packageJson.version;
const date = new Date().toISOString().split("T")[0]; // YYYY-MM-DD
const newEntry = `## [${version}] ${date}\n\n- ${commitMsg}\n\n---\n`;
const oldChangelog = fs.readFileSync(changelogPath, "utf-8");
fs.writeFileSync(changelogPath, newEntry + oldChangelog, "utf-8");
console.log("✅ CHANGELOG.md aktualisiert mit Commit-Message:", commitMsg);