# Keeps a list of open failures for each docs workflow below, and posts to Slack when the list # changes. Each failure names the commit that introduced it, or its possible commits. Docs E2E Tests # reaches master only through a manual run. e2e/docs/scripts/docs-alert.ts holds the logic. name: Alert on master breakage on: workflow_run: workflows: - 'Docs E2E Tests' - '[Docs] Update last-changed dates' - 'Update JS Client Libraries Docs' - 'Update Mgmt Api Docs' - 'docs_sync' - 'Docs Production Smoke Tests' - 'Docs Accessibility Scan' - 'Ingest Docs Content for Search V2' branches: [master] types: - completed permissions: contents: read actions: read statuses: read concurrency: group: ${{ github.workflow }}-${{ github.event.workflow_run.workflow_id }} cancel-in-progress: false jobs: notify: if: >- github.event.workflow_run.head_repository.full_name == github.repository && (github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure') runs-on: ubuntu-latest env: STATE_NAME: docs-open-failures-${{ github.event.workflow_run.workflow_id }} steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false sparse-checkout: | e2e/docs e2e/shared apps/docs/content - name: Use Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version-file: '.nvmrc' - name: Download the saved list and the run's results env: GH_TOKEN: ${{ github.token }} REPO: ${{ github.repository }} RUN_ID: ${{ github.event.workflow_run.id }} RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }} run: | mkdir -p "$RUNNER_TEMP/state-in" "$RUNNER_TEMP/state-out" "$RUNNER_TEMP/results" # Only trust a saved list from a master run in this repo, not from a fork or a branch ID=$(gh api "repos/$REPO/actions/artifacts?name=$STATE_NAME&per_page=100" \ --jq '[.artifacts[] | select((.expired | not) and .workflow_run.head_branch == "master" and .workflow_run.head_repository_id == .workflow_run.repository_id)] | max_by(.created_at) | .id // empty') if [ -n "$ID" ]; then gh api "repos/$REPO/actions/artifacts/$ID/zip" > "$RUNNER_TEMP/state.zip" unzip -o -q "$RUNNER_TEMP/state.zip" open-failures.json -d "$RUNNER_TEMP/state-in" fi gh run download "$RUN_ID" --repo "$REPO" --name "docs-failures-$RUN_ATTEMPT" \ --dir "$RUNNER_TEMP/results" || echo "No results artifact on this run." - name: Update the list and post changes env: GITHUB_TOKEN: ${{ github.token }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOCS_WEBHOOK_URL }} run: | STATE_IN="$RUNNER_TEMP/state-in/open-failures.json" \ STATE_OUT="$RUNNER_TEMP/state-out/open-failures.json" \ RESULTS_DIR="$RUNNER_TEMP/results" \ node --experimental-strip-types e2e/docs/scripts/docs-alert.ts - name: Save the list uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: ${{ env.STATE_NAME }} path: ${{ runner.temp }}/state-out/open-failures.json retention-days: 90 if-no-files-found: ignore