Last active
March 3, 2023 20:44
-
-
Save ErickPetru/3a32140e329272741915dca073e2cef2 to your computer and use it in GitHub Desktop.
Creates Changelog Messages by Scrapping GitHub Projects View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run using browser console after opening the page: | |
// https://github.com/orgs/fridayfinance/projects/6/views/9 | |
console.log( | |
[ | |
...document | |
.querySelector('[data-test-id="table-scroll-container"') | |
.querySelectorAll('div[data-test-id$="column: Title}"] a'), | |
] | |
.sort((a, b) => | |
a.innerText | |
.replace("[TASK] ", "") | |
.localeCompare(b.innerText.replace("[TASK] ", "")) | |
) | |
.map((a) => { | |
const row = a.parentElement.parentElement.parentElement; | |
const labels = [...row.querySelectorAll('[class^="Label-sc-"]')].map( | |
(el) => el.innerText | |
); | |
const links = [ | |
...row.querySelectorAll('[class^="Link__StyledLink-"]'), | |
].map((el) => el.innerText); | |
const sprint = links.find((link) => link.startsWith("Sprint ")); | |
const explanation = labels.includes("anticipated") | |
? "anticipated from " | |
: labels.find((label) => label.startsWith("delayed-")) | |
? "delayed from " | |
: ""; | |
const title = | |
`[${a.innerText}](${a.href}) _(${explanation}${sprint})_`.replace( | |
"[TASK] ", | |
"" | |
); | |
return labels.includes("bug") | |
? `🐞 ${title}` | |
: labels.includes("refactor") | |
? `🔧 ${title}` | |
: labels.includes("documentation") | |
? `📝 ${title}` | |
: labels.includes("infrastructure") | |
? `☁️ ${title}` | |
: labels.includes("automation") | |
? `🦾 ${title}` | |
: `✨ ${title}`; | |
}) | |
.join("\n") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment