mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2025-01-23 13:54:46 +01:00
24 lines
945 B
JavaScript
24 lines
945 B
JavaScript
const getReleaseLine = async (changeset, _type) => {
|
|
const [firstLine, ...futureLines] = changeset.summary.split("\n").map(l => l.trimRight());
|
|
let returnVal = `- ${changeset.commit ? `${changeset.commit}: ` : ""}${firstLine}`;
|
|
|
|
if (futureLines.length > 0) {
|
|
returnVal += `\n${futureLines.map(l => ` ${l}`).join("\n")}`;
|
|
}
|
|
|
|
return returnVal;
|
|
};
|
|
|
|
const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => {
|
|
if (dependenciesUpdated.length === 0) return "";
|
|
const changesetLinks = changesets.map(changeset => `- Updated dependencies${changeset.commit ? ` [${changeset.commit}]` : ""}`);
|
|
const updatedDependenciesList = dependenciesUpdated.map(dependency => ` - ${dependency.name}@${dependency.newVersion}`);
|
|
return [...changesetLinks, ...updatedDependenciesList].join("\n");
|
|
};
|
|
|
|
const defaultChangelogFunctions = {
|
|
getReleaseLine,
|
|
getDependencyReleaseLine
|
|
};
|
|
|
|
export default defaultChangelogFunctions;
|