ci: only group errors

This commit is contained in:
Isaac 2024-03-03 20:35:52 +00:00
parent 6ea9a3fb66
commit b2851c1cd8
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -191,22 +191,22 @@ async function summarise() {
for (const locale of locales) { for (const locale of locales) {
// thanks copilot // thanks copilot
console.log(`::group::${locale}`);
const localeErrors = errors.filter(error => error.locale === locale); const localeErrors = errors.filter(error => error.locale === locale);
summary += `## \`${locale}\`\n\n`; summary += `## \`${locale}\`\n\n`;
if (localeErrors.length > 0) { if (localeErrors.length > 0) {
console.log(`::group::${locale}`);
for (const error of localeErrors) { for (const error of localeErrors) {
summary += `https://github.com/discord-tickets/bot/blob/${branch}/src/i18n/${locale}.yml#L${error.line}\n\n`; summary += `https://github.com/discord-tickets/bot/blob/${branch}/src/i18n/${locale}.yml#L${error.line}\n\n`;
console.log(`::error file=src/i18n/${locale}.yml,line=${error.line},col=${error.col}::${error.message}`); console.log(`::error file=src/i18n/${locale}.yml,line=${error.line},col=${error.col}::${error.message}`);
} }
console.log('::endgroup::');
} else { } else {
summary += 'No errors found\n\n'; summary += 'No errors found\n\n';
// console.log(`::notice file=src/i18n/${locale}.yml::No errors found`); // console.log(`::notice file=src/i18n/${locale}.yml::No errors found`);
} }
console.log('::endgroup::');
} }
fs.writeFileSync(process.env.GITHUB_STEP_SUMMARY || 'summary.md', summary); fs.writeFileSync(process.env.GITHUB_STEP_SUMMARY || 'summary.md', summary);