Skip to content

Commit 0a68afd

Browse files
fix: skip coverage grade comment when grade unavailable
1 parent 1a48a87 commit 0a68afd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎.github/workflows/sonar-check.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,17 @@ jobs:
7676
const grade = '${{ steps.grade.outputs.coverage_grade }}';
7777
const label = '${{ steps.grade.outputs.coverage_grade_label }}';
7878
const linePct = '${{ steps.grade.outputs.line_coverage }}';
79-
const branchPct = '${{ steps.grade.outputs.branch_coverage }}';
79+
const branchPct = '${{ steps.grade.outputs.branch_coverage || 'N/A' }}';
8080
const emojiMap = { A: '🟢', B: '🟡', C: '🟠', D: '🔴', F: '⛔' };
8181
const emoji = emojiMap[grade] ?? '❓';
8282
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
8383
const marker = '<!-- coverage-grade-bot -->';
8484
85+
if (!grade || grade === 'N/A') {
86+
console.log('Coverage grade not available, skipping comment');
87+
return;
88+
}
89+
8590
const branchRow = branchPct !== 'N/A'
8691
? `| Branch coverage | **${branchPct}%** |`
8792
: '';

0 commit comments

Comments
 (0)