Address code review feedback
- Remove unnecessary comment about fallback default in resolve-review-urls.js - Use plain text sanitization for skip reasons in preview comments - Add clarifying comment about string comparison in GitHub Actions outputs Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com>pull/6938/head
parent
720c99e72c
commit
8e6a29ec80
|
|
@ -105,10 +105,12 @@ export function generatePreviewComment(options) {
|
|||
break;
|
||||
|
||||
case 'skipped':
|
||||
// Skip reasons are controlled strings from the workflow, plain text sanitization is sufficient
|
||||
const safeSkipReason = (skipReason || 'No previewable changes detected.').substring(0, 200);
|
||||
body += `| Status | Details |\n`;
|
||||
body += `|--------|----------|\n`;
|
||||
body += `| **Result** | ⏭️ SKIPPED |\n`;
|
||||
body += `| **Reason** | ${sanitizeForCodeBlock(skipReason || 'No previewable changes detected.', 200)} |\n`;
|
||||
body += `| **Reason** | ${safeSkipReason} |\n`;
|
||||
body += `| **Checked** | ${timestamp} |`;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ if (urls.length === 0) {
|
|||
console.log(`Visual review skipped: ${skipReason}`);
|
||||
} else {
|
||||
appendFileSync(GITHUB_OUTPUT, `skipped=false\n`);
|
||||
appendFileSync(GITHUB_OUTPUT, `skip-reason=\n`);
|
||||
}
|
||||
|
||||
console.log(`Detected ${urls.length} preview URLs`);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,10 @@ jobs:
|
|||
'',
|
||||
'### Pages to Review',
|
||||
'',
|
||||
...urls.slice(0, 10).map(u => `- \`${u}\` → [preview](${previewBase}${u})`),
|
||||
...urls.slice(0, 10).map(u => {
|
||||
const pageUrl = `${previewBase}${u}`;
|
||||
return `- \`${u}\` → [preview](${pageUrl})`;
|
||||
}),
|
||||
...(urls.length > 10 ? [`- ... and ${urls.length - 10} more (see PR Preview comment)`] : []),
|
||||
].join('\n');
|
||||
|
||||
|
|
@ -301,9 +304,8 @@ jobs:
|
|||
permissions:
|
||||
pull-requests: write
|
||||
needs: resolve-urls
|
||||
if: |
|
||||
needs.resolve-urls.result == 'success' &&
|
||||
fromJson(needs.resolve-urls.outputs.url-count) == 0
|
||||
# GitHub Actions outputs are always strings; 'true' string comparison is intentional
|
||||
if: needs.resolve-urls.result == 'success' && needs.resolve-urls.outputs.skipped == 'true'
|
||||
steps:
|
||||
- name: Post skipped notice
|
||||
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue