From e30f99bd259e76ccda910b3e89dec02a9aef1b7e Mon Sep 17 00:00:00 2001 From: f-trycua Date: Wed, 19 Nov 2025 00:00:23 +0100 Subject: [PATCH] Fix version determination logic for workflow_call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bug: When pypi-publish-agent is called via workflow_call from bump-version, github.event_name is "workflow_dispatch" (inherited from parent), NOT "workflow_call". This caused the code to check github.event.inputs.version (empty) instead of inputs.version (0.4.44). The fix: Check inputs.version first, before checking event_name. This works correctly for: - workflow_call: uses inputs.version - Tag push: extracts from tag - workflow_dispatch with version param: uses inputs.version - workflow_dispatch event UI: uses event.inputs.version Debug output showed: - Event name: workflow_dispatch - Input version: 0.4.44 (correct!) - Workflow dispatch version: (empty) - Final VERSION= (bug - used wrong source) Now it will use inputs.version first, giving VERSION=0.4.44. Fixes: https://github.com/trycua/cua/actions/runs/19483269380 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/pypi-publish-agent.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi-publish-agent.yml b/.github/workflows/pypi-publish-agent.yml index baa1ce3a..715eac80 100644 --- a/.github/workflows/pypi-publish-agent.yml +++ b/.github/workflows/pypi-publish-agent.yml @@ -51,20 +51,30 @@ jobs: echo "Workflow dispatch version: ${{ github.event.inputs.version }}" echo "GitHub ref: ${{ github.ref }}" - if [ "${{ github.event_name }}" == "push" ]; then + # Check inputs.version first (works for workflow_call regardless of event_name) + if [ -n "${{ inputs.version }}" ]; then + # Version provided via workflow_call or workflow_dispatch with version input + VERSION=${{ inputs.version }} + echo "Using inputs.version: $VERSION" + elif [ "${{ github.event_name }}" == "push" ]; then # Extract version from tag (for package-specific tags) if [[ "${{ github.ref }}" =~ ^refs/tags/agent-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then VERSION=${BASH_REMATCH[1]} + echo "Extracted from tag: $VERSION" else echo "Invalid tag format for agent" exit 1 fi - elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - # Use version from workflow dispatch + elif [ -n "${{ github.event.inputs.version }}" ]; then + # Use version from workflow_dispatch event inputs VERSION=${{ github.event.inputs.version }} + echo "Using event.inputs.version: $VERSION" else - # Use version from workflow_call - VERSION=${{ inputs.version }} + echo "ERROR: No version found!" + echo " - inputs.version is empty" + echo " - event.inputs.version is empty" + echo " - Not a tag push event" + exit 1 fi echo "=== Final Version ==="