From cc34844c6efc1523b3a55127da124f100cafce09 Mon Sep 17 00:00:00 2001 From: torlando-tech Date: Fri, 7 Nov 2025 22:38:18 -0500 Subject: [PATCH] fix(ci): Use workflow_run trigger to depend on test workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed from invalid cross-workflow job dependency (needs) to workflow_run trigger. Deploy now runs after "Tests" workflow completes successfully. Changes: - Trigger on workflow_run instead of push - Only run if test workflow conclusion is success - Use workflow_run event refs for branch/commit/actor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/deploy.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7f06290..8e26ffc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,19 +1,18 @@ name: Deploy to Raspberry Pi on: - push: + workflow_run: + workflows: ["Tests"] + types: + - completed branches: [ "*" ] - paths: - - 'src/**' - - '.github/workflows/deploy.yml' jobs: deploy: name: Deploy to Raspberry Pis runs-on: self-hosted - needs: [unit-tests, integration-tests] - # Only run if tests exist and passed (skip if no Python changes detected) - if: always() && (needs.unit-tests.result == 'success' || needs.unit-tests.result == 'skipped') && (needs.integration-tests.result == 'success' || needs.integration-tests.result == 'skipped') + # Only run if tests passed or were skipped + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Validate required secrets @@ -68,7 +67,7 @@ jobs: PI_HOSTS: ${{ secrets.PI_HOSTS }} PI_REPO_PATH: ${{ secrets.PI_REPO_PATH }} PI_USER: ${{ secrets.PI_USER }} - BRANCH_NAME: ${{ github.ref_name }} + BRANCH_NAME: ${{ github.event.workflow_run.head_branch }} run: | # Split comma-separated PI_HOSTS into array IFS=',' read -ra HOSTS <<< "$PI_HOSTS" @@ -176,9 +175,9 @@ jobs: if: always() run: | echo "## Deployment Results" >> $GITHUB_STEP_SUMMARY - echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY - echo "- **Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY - echo "- **Triggered by:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY + echo "- **Branch:** ${{ github.event.workflow_run.head_branch }}" >> $GITHUB_STEP_SUMMARY + echo "- **Commit:** ${{ github.event.workflow_run.head_sha }}" >> $GITHUB_STEP_SUMMARY + echo "- **Triggered by:** ${{ github.event.workflow_run.actor.login }}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY if [ "${{ job.status }}" == "success" ]; then echo "✓ All Raspberry Pis deployed successfully" >> $GITHUB_STEP_SUMMARY