@@ -294,14 +294,66 @@ jobs:
294294 echo 'EOF'
295295 } >> "$GITHUB_OUTPUT"
296296
297+ - name : Close previous scraping failure issues
298+ if : ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result).hasFailures }}
299+ env :
300+ GH_TOKEN : ${{ secrets.DOCS_BOT_PAT_BASE }}
301+ RUN_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
302+ run : |
303+ open_issues=$(gh issue list \
304+ --repo github/docs-engineering \
305+ --label "search-scraping-failures" \
306+ --state open \
307+ --json number \
308+ --jq '.[].number')
309+ for issue in $open_issues; do
310+ gh issue close "$issue" \
311+ --repo github/docs-engineering \
312+ --comment "Closing in favor of a newer scraping failure report from $RUN_URL"
313+ done
314+
315+ - name : Create scraping failure issue
316+ if : ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result).hasFailures }}
317+ env :
318+ GH_TOKEN : ${{ secrets.DOCS_BOT_PAT_BASE }}
319+ FAILURE_MESSAGE : ${{ fromJSON(steps.aggregate.outputs.result).message }}
320+ RUN_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
321+ FILE_URL : ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/index-general-search.yml
322+ WORKFLOW_NAME : ${{ github.workflow }}
323+ run : |
324+ body=$(cat <<EOF
325+ ### Search index scraping failures
326+
327+ $FAILURE_MESSAGE
328+
329+ ---
330+ **Workflow run:** $RUN_URL
331+ **Workflow file:** $FILE_URL
332+
333+ This issue was automatically created by the \`$WORKFLOW_NAME\` workflow.
334+ EOF
335+ )
336+ gh issue create \
337+ --repo github/docs-engineering \
338+ --label "search-scraping-failures" \
339+ --title "[Search Scraping Failures] $(date -u +%Y-%m-%d)" \
340+ --body "$body"
341+
297342 - name : Send consolidated Slack notification
298343 if : ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result).hasFailures }}
299344 uses : ./.github/actions/slack-alert
300345 with :
301346 slack_channel_id : ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
302347 slack_token : ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
348+ color : warning
303349 message : ${{ fromJSON(steps.aggregate.outputs.result).message }}
304350
351+ - uses : ./.github/actions/slack-alert
352+ if : ${{ failure() }}
353+ with :
354+ slack_channel_id : ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
355+ slack_token : ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
356+
305357 - uses : ./.github/actions/create-workflow-failure-issue
306358 if : ${{ failure() }}
307359 with :
0 commit comments