From c0be5deab6e49fe171558187aec2efe2b9b329be Mon Sep 17 00:00:00 2001 From: Dan Kotowski Date: Tue, 21 Jul 2026 09:43:45 -0500 Subject: [PATCH] Gate Pages deploy on ci-test passing (#238) A merge to main could break the app even though the PR check ran ci-test separately; deploy previously fired on push regardless of CI outcome. Trigger deploy via workflow_run on ci-test completion instead, and skip the build job unless ci-test concluded success, so a broken main no longer publishes to Pages. --- .github/workflows/deploy.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 07e320f..af41398 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,18 +1,22 @@ name: deploy -run-name: "${{ github.actor }} is deploying ${{ github.sha }}" +run-name: "${{ github.actor }} is deploying ${{ github.event.workflow_run.head_sha }}" on: - push: - branches: - - 'main' + workflow_run: + workflows: ['ci-test'] + types: [completed] + branches: ['main'] concurrency: group: pages cancel-in-progress: false jobs: build: + if: github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 + with: + ref: ${{ github.event.workflow_run.head_sha }} - name: Setup pnpm uses: pnpm/action-setup@v5 - name: Setup Node.js @@ -41,6 +45,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 + with: + ref: ${{ github.event.workflow_run.head_sha }} - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v5 @@ -48,6 +54,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - tag="deploy-$(date +%Y-%m-%d)-${GITHUB_SHA::7}" - git tag "$tag" + sha="${{ github.event.workflow_run.head_sha }}" + tag="deploy-$(date +%Y-%m-%d)-${sha::7}" + git tag "$tag" "$sha" git push origin "$tag"