From a109ae83f9d16eb09578c96358f64bf323e1e8cd Mon Sep 17 00:00:00 2001 From: torlando-tech Date: Sat, 8 Nov 2025 18:43:31 -0500 Subject: [PATCH] fix(ci): Fix deploy workflow branch detection for manual triggers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deploy workflow was failing when manually triggered via workflow_dispatch because it only checked for github.event.workflow_run.head_branch, which is empty for manual triggers. Issue: - Manual trigger: gh workflow run deploy.yml --ref refactor/abstraction-layer - BRANCH_NAME was empty ("") - git checkout "" failed: "empty string is not a valid pathspec" - Deployment failed on all Pis Fix: - Use fallback operator: github.event.workflow_run.head_branch || github.ref_name - workflow_run trigger: uses head_branch (branch that triggered the tests) - workflow_dispatch trigger: uses ref_name (branch being run on) Now works for both: - Automatic deployment after tests complete - Manual deployment via workflow_dispatch or gh CLI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3f78a1f..9de8eb4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -67,7 +67,7 @@ jobs: PI_HOSTS: ${{ secrets.PI_HOSTS }} PI_REPO_PATH: ${{ secrets.PI_REPO_PATH }} PI_USER: ${{ secrets.PI_USER }} - BRANCH_NAME: ${{ github.event.workflow_run.head_branch }} + BRANCH_NAME: ${{ github.event.workflow_run.head_branch || github.ref_name }} run: | # Split comma-separated PI_HOSTS into array IFS=',' read -ra HOSTS <<< "$PI_HOSTS"