Skip to content

Instantly share code, notes, and snippets.

@JoshuaKGoldberg
Last active September 15, 2023 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaKGoldberg/3876ed731e5bf09d280d4ae7b5f23d7d to your computer and use it in GitHub Desktop.
Save JoshuaKGoldberg/3876ed731e5bf09d280d4ae7b5f23d7d to your computer and use it in GitHub Desktop.
Automating Tidelift tasks because the website takes too long to use
function waitFor(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
async function acceptVisiblePackages() {
const containers = document.querySelectorAll("#container");
for (const container of containers) {
container.click();
await waitFor(500);
const choice = document.querySelector(`[value=repository_license]`);
choice.scrollIntoView();
choice.click();
await waitFor(500);
document.querySelector(".drawer-card-foot button").click();
await waitFor(500);
}
}
for (const pager of document.querySelectorAll(".pagination-list li")) {
pager.click();
await waitFor(2500); // todo: be more intelligent
await acceptVisiblePackages();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment