Post-Deploy Health Check #2737
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: Post-Deploy Health Check | |
| on: | |
| workflow_run: | |
| workflows: ["Deploy"] | |
| types: [completed] | |
| schedule: | |
| - cron: "15 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| health-check: | |
| if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout (manual/scheduled) | |
| if: github.event_name != 'workflow_run' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - name: Checkout deployed commit (workflow_run) | |
| if: github.event_name == 'workflow_run' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| ref: main | |
| - name: Determine health check mode | |
| id: health-check-mode | |
| shell: bash | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| run: | | |
| if [ -z "${VERCEL_TOKEN}" ]; then | |
| echo "::warning::Running public route checks without Vercel CLI: missing VERCEL_TOKEN." | |
| echo "use_vercel_cli=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "use_vercel_cli=true" >> "$GITHUB_OUTPUT" | |
| - name: Set up Bun | |
| if: steps.health-check-mode.outputs.use_vercel_cli == 'true' | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: "1.3.10" | |
| - name: Prepare Vercel CLI | |
| if: steps.health-check-mode.outputs.use_vercel_cli == 'true' | |
| shell: bash | |
| run: echo "Using bunx vercel@50.13.2 for production checks." | |
| - name: Run production health check | |
| shell: bash | |
| env: | |
| APP_URL: https://blog-ai.vivancedata.com | |
| ROUTES: / /pricing /blog /tool-directory /sitemap.xml | |
| LOOKBACK: 1h | |
| LOG_LIMIT: 200 | |
| FAIL_ON_WARNINGS: "false" | |
| USE_BUNX_VERCEL: ${{ steps.health-check-mode.outputs.use_vercel_cli }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| VERCEL_PROJECT: ${{ secrets.VERCEL_PROJECT_ID }} | |
| run: bash scripts/post_deploy_health_check.sh |