Damans227 commented on code in PR #14299:
URL: https://github.com/apache/cloudstack/pull/14299#discussion_r4272791358


##########
.github/workflows/sonar-check.yml:
##########
@@ -76,12 +76,17 @@ jobs:
             const grade     = '${{ steps.grade.outputs.coverage_grade }}';
             const label     = '${{ steps.grade.outputs.coverage_grade_label 
}}';
             const linePct   = '${{ steps.grade.outputs.line_coverage }}';
-            const branchPct = '${{ steps.grade.outputs.branch_coverage }}';
+            const branchPct = '${{ steps.grade.outputs.branch_coverage || 
'N/A' }}';
             const emojiMap  = { A: '🟢', B: '🟡', C: '🟠', D: '🔴', F: '⛔' };
             const emoji     = emojiMap[grade] ?? '❓';
             const runUrl    = 
`${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
             const marker    = '<!-- coverage-grade-bot -->';
 
+            if (!grade || grade === 'N/A') {

Review Comment:
   when does the grade come through empty here? the script exits before writing 
it when the report is missing, so this step doesnt run then



##########
.github/workflows/sonar-check.yml:
##########
@@ -76,12 +76,17 @@ jobs:
             const grade     = '${{ steps.grade.outputs.coverage_grade }}';
             const label     = '${{ steps.grade.outputs.coverage_grade_label 
}}';
             const linePct   = '${{ steps.grade.outputs.line_coverage }}';
-            const branchPct = '${{ steps.grade.outputs.branch_coverage }}';
+            const branchPct = '${{ steps.grade.outputs.branch_coverage || 
'N/A' }}';
             const emojiMap  = { A: '🟢', B: '🟡', C: '🟠', D: '🔴', F: '⛔' };
             const emoji     = emojiMap[grade] ?? '❓';
             const runUrl    = 
`${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
             const marker    = '<!-- coverage-grade-bot -->';
 
+            if (!grade || grade === 'N/A') {
+              console.log('Coverage grade not available, skipping comment');

Review Comment:
   does this fix the 403 from #13490? on a fork PR the grade is there, so 
posting the comment still fails with the read-only token



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to