Skip to content

Commit e5739d3

Browse files
heiskrCopilot
andauthored
Fix fromJSON crash in search indexing workflow when no failures exist (#60118)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2b11c5c commit e5739d3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/index-general-search.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ jobs:
295295
} >> "$GITHUB_OUTPUT"
296296
297297
- name: Close previous scraping failure issues
298-
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result).hasFailures }}
298+
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result || '{"hasFailures":false}').hasFailures }}
299299
env:
300300
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
301301
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
@@ -313,10 +313,10 @@ jobs:
313313
done
314314
315315
- name: Create scraping failure issue
316-
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result).hasFailures }}
316+
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result || '{"hasFailures":false}').hasFailures }}
317317
env:
318318
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
319-
FAILURE_MESSAGE: ${{ fromJSON(steps.aggregate.outputs.result).message }}
319+
FAILURE_MESSAGE: ${{ fromJSON(steps.aggregate.outputs.result || '{"message":""}').message }}
320320
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
321321
FILE_URL: ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/index-general-search.yml
322322
WORKFLOW_NAME: ${{ github.workflow }}
@@ -340,13 +340,13 @@ jobs:
340340
--body "$body"
341341
342342
- name: Send consolidated Slack notification
343-
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result).hasFailures }}
343+
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result || '{"hasFailures":false}').hasFailures }}
344344
uses: ./.github/actions/slack-alert
345345
with:
346346
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
347347
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
348348
color: warning
349-
message: ${{ fromJSON(steps.aggregate.outputs.result).message }}
349+
message: ${{ fromJSON(steps.aggregate.outputs.result || '{"message":""}').message }}
350350

351351
- uses: ./.github/actions/slack-alert
352352
if: ${{ failure() }}

0 commit comments

Comments
 (0)