Releases to Changelog

I just automatically made a Changelog by going to https://github.com/arcanistzed/scs/releases and running this:
let results = [];
document.querySelectorAll(".release-main-section").forEach(release => {
let header = release.querySelector(".release-header");
let title = header.querySelector(".release-header > div > div > a").innerText;
let version = header.querySelector("svg+span.css-truncate-target").innerText;
let date = release.querySelector("relative-time").title.split(",")[0];
let content = release.querySelector(".markdown-body")?.innerHTML.trim();
results.push(`<h2>${[version, date, title].join(" - ")}</h1>${[content].join("")}`);
});
console.log(results.join("\n<br/>\n"));
let results = [];
document.querySelectorAll(".release-main-section").forEach(release => {
let header = release.querySelector(".release-header");
let title = header.querySelector(".release-header > div > div > a").innerText;
let version = header.querySelector("svg+span.css-truncate-target").innerText;
let date = release.querySelector("relative-time").title.split(",")[0];
let content = release.querySelector(".markdown-body")?.innerHTML.trim();
results.push(`<h2>${[version, date, title].join(" - ")}</h1>${[content].join("")}`);
});
console.log(results.join("\n<br/>\n"));
I converted it to Markdown and 🎉
4 Replies
Calego
Calego•4y ago
May I recommend the Github API Docs? https://docs.github.com/en/rest/reference/repos#releases I suspect you could get the raw JSON of these releases rather than needing to parse the DOM https://api.github.com/repos/arcanistzed/scs/releases
Daniel Thorp
Daniel ThorpOP•4y ago
Indeed, I hadn't thought of that. I intend this to be a one time process though, since I'll make them manually in the future
Calego
Calego•4y ago
this gives me an idea for a gh action workflow actually...
on:
release:
types: [edited, published]
on:
release:
types: [edited, published]
hmmmm
Daniel Thorp
Daniel ThorpOP•4y ago
Want results from more Discord servers?
Add your server