Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1601

Merged
merged 2 commits into from
Oct 8, 2024
Merged

Dev #1601

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/scripts/weekly-label-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function fetchOpenIssues() {

async function main() {
const openIssues = await fetchOpenIssues();
let totalSuccessfulIssues = 0;

for (const issue of openIssues) {
const labels = issue.labels.map((label) => label.name);
Expand All @@ -48,9 +49,17 @@ async function main() {
);
} else {
console.log(`Labels to add for issue #${issue.number}: `, labelsToAdd);
await addLabels(labelsToAdd, issue.number);
const successfulIssue = await addLabels(labelsToAdd, issue.number);

if (successfulIssue) {
totalSuccessfulIssues++;
console.log(`Successfully added labels to issue #${issue.number}`);
} else {
throw new Error(`Failed to process issue #${issue.number}`);
}
}
}
console.log(totalSuccessfulIssues, " issues have been successfully labeled");
}

function filterLabels(labels) {
Expand Down Expand Up @@ -88,14 +97,20 @@ async function addLabels(
issue_number: issueNum,
labels: labels,
});
if (labelsToAdd.length > 0) {
console.log("Successfully added labels to issue #", issueNum);
}
return true;
} catch (err) {
console.error("Error editing labels: ", err);
return false;
throw new Error(
`Failed to add labels to issue #${issueNum}: ${err.message}`
);
}
}

main().catch(console.error);
(async () => {
try {
await main();
} catch (err) {
console.error("Action aborted because error occurred:", err.message);
process.exit(1);
}
})();