From 8e6a29ec804ebb189165c58d077a788284bdcf98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:30:42 +0000 Subject: [PATCH] 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> --- .github/scripts/preview-comment.js | 4 +++- .github/scripts/resolve-review-urls.js | 1 - .github/workflows/doc-review.yml | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/scripts/preview-comment.js b/.github/scripts/preview-comment.js index 447a6c7ab..8c3966600 100644 --- a/.github/scripts/preview-comment.js +++ b/.github/scripts/preview-comment.js @@ -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; } diff --git a/.github/scripts/resolve-review-urls.js b/.github/scripts/resolve-review-urls.js index ad9ba4b83..173f18f4f 100644 --- a/.github/scripts/resolve-review-urls.js +++ b/.github/scripts/resolve-review-urls.js @@ -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`); diff --git a/.github/workflows/doc-review.yml b/.github/workflows/doc-review.yml index d2a63f43a..11c807b2a 100644 --- a/.github/workflows/doc-review.yml +++ b/.github/workflows/doc-review.yml @@ -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