From 29b6840c58166c6d5fc605241a3c6397593fe22f Mon Sep 17 00:00:00 2001 From: Ethan Jones Date: Tue, 17 Feb 2026 22:17:07 -0500 Subject: [PATCH] Fix SyntaxError in auto-merge workflow when check-approval step is skipped When a PR touches non-dotnet files, the check-approval step is skipped, leaving its outputs empty. The "Add comment if not eligible" step's inline JavaScript referenced those empty outputs directly, producing invalid JS like `const approvalResult = ;` before the interpreter could run it. Add || fallbacks so the template expressions always produce valid JSON. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/auto-merge-dotnet-docs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-merge-dotnet-docs.yaml b/.github/workflows/auto-merge-dotnet-docs.yaml index b7157ff1..1d62ff95 100644 --- a/.github/workflows/auto-merge-dotnet-docs.yaml +++ b/.github/workflows/auto-merge-dotnet-docs.yaml @@ -214,9 +214,9 @@ jobs: if ('${{ steps.check-files.outputs.all_dotnet_docs }}' !== 'true') { reason = '❌ This PR includes files outside of .NET-related paths and cannot be auto-merged.'; } else { - const approvalResult = ${{ steps.check-approval.outputs.result }}; + const approvalResult = ${{ steps.check-approval.outputs.result || '{"approved":false,"approver":null}' }}; if (!approvalResult.approved) { - const codeOwners = ${{ steps.check-files.outputs.owners }}; + const codeOwners = ${{ steps.check-files.outputs.owners || '[]' }}; const ownerMentions = codeOwners.map(owner => `@${owner}`).join(', '); reason = `⏳ Waiting for a 👍 comment from a code owner (${ownerMentions}) for auto-merge.`; }