From f9fa2540a23a3919a2a08f513c9a7940b691a00d Mon Sep 17 00:00:00 2001 From: Astisme Date: Thu, 2 Jan 2025 18:42:43 +0100 Subject: [PATCH] clean error output --- .github/workflows/pr-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 0732fe3..04d5cc6 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -45,18 +45,20 @@ jobs: // Read the linter error output const errorOutput = fs.readFileSync('lint-error.log', 'utf8'); - if (!errorOutput) { console.log("No lint errors."); return; } + // Remove ANSI codes + const cleanErrorOutput = str.replace(/\x1b\[[0-9;]*m/g;, ''); + // Create a comment on the PR with the error message await github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `## Linter Failed:\n\n\`\`\`${errorOutput}\`\`\`` + body: `## Linter Failed:\n\n\`\`\`${cleanErrorOutput}\`\`\`` }); - name: Remove lint-error.log