Pages production health · schedule #1330
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: GitHub Pages Production Monitor | |
| run-name: Pages production health · ${{ github.event_name }} | |
| on: | |
| pull_request: | |
| paths: | |
| - ".github/pages-monitor-policy.json" | |
| - ".github/fixtures/pages-monitor-version-contract.json" | |
| - ".github/scripts/check_pages_live.py" | |
| - ".github/scripts/reconcile_pages_incident.sh" | |
| - ".github/scripts/test_pages_monitor_reconciliation_contract.py" | |
| - ".github/scripts/test_pages_monitor_version_contract.py" | |
| - ".github/workflows/pages-production-monitor.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/pages-monitor-policy.json" | |
| - ".github/fixtures/pages-monitor-version-contract.json" | |
| - ".github/scripts/check_pages_live.py" | |
| - ".github/scripts/reconcile_pages_incident.sh" | |
| - ".github/scripts/test_pages_monitor_reconciliation_contract.py" | |
| - ".github/scripts/test_pages_monitor_version_contract.py" | |
| - ".github/workflows/pages-production-monitor.yml" | |
| workflow_run: | |
| workflows: | |
| - GitHub Pages Documentation | |
| types: | |
| - completed | |
| schedule: | |
| - cron: "37 */6 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| concurrency: | |
| group: toolkit-pages-production-monitor-${{ github.event_name == 'pull_request' && github.event.pull_request.number || 'production' }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| monitor: | |
| if: >- | |
| github.event_name != 'workflow_run' || | |
| (github.event.workflow_run.event != 'pull_request' && github.event.workflow_run.conclusion == 'success') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out monitored source | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} | |
| persist-credentials: false | |
| - name: Overlay authoritative release-state dashboard | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git fetch --no-tags --depth=1 origin \ | |
| +refs/heads/release-state:refs/remotes/origin/release-state | |
| git restore --source=refs/remotes/origin/release-state -- \ | |
| status/release-dashboard.json | |
| - name: Validate monitor scripts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| python3 -m py_compile .github/scripts/check_pages_live.py | |
| python3 -m py_compile .github/scripts/test_pages_monitor_reconciliation_contract.py | |
| python3 -m py_compile .github/scripts/test_pages_monitor_version_contract.py | |
| python3 .github/scripts/test_pages_monitor_reconciliation_contract.py | |
| python3 .github/scripts/test_pages_monitor_version_contract.py | |
| bash -n .github/scripts/reconcile_pages_incident.sh | |
| - name: Check live GitHub Pages deployment | |
| id: health | |
| env: | |
| MAX_ATTEMPTS: ${{ (github.event_name == 'workflow_run' || github.event_name == 'push') && '16' || '1' }} | |
| RETRY_SECONDS: "15" | |
| shell: bash | |
| run: | | |
| set +e | |
| STATUS=1 | |
| for ATTEMPT in $(seq 1 "$MAX_ATTEMPTS"); do | |
| python3 .github/scripts/check_pages_live.py | |
| STATUS=$? | |
| if [[ "$STATUS" -eq 0 ]]; then | |
| echo "Live Pages matched the verified release on attempt ${ATTEMPT}." | |
| break | |
| fi | |
| if [[ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]]; then | |
| echo "Pages propagation not complete on attempt ${ATTEMPT}; retrying in ${RETRY_SECONDS}s." | |
| sleep "$RETRY_SECONDS" | |
| fi | |
| done | |
| echo "exit_code=$STATUS" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| - name: Publish monitor summary | |
| if: always() | |
| run: cat pages-production-health.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload production diagnostics | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: github-pages-production-health | |
| path: | | |
| pages-production-health.json | |
| pages-production-health.md | |
| if-no-files-found: error | |
| retention-days: 30 | |
| - name: Reconcile persistent incident | |
| if: >- | |
| always() && | |
| github.event_name != 'pull_request' && | |
| (github.event_name != 'workflow_run' || github.event.workflow_run.event != 'pull_request') | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_COMMITS_WEBHOOK }} | |
| HEALTH_EXIT: ${{ steps.health.outputs.exit_code }} | |
| shell: bash | |
| run: bash .github/scripts/reconcile_pages_incident.sh |