Fix version determination logic for workflow_call

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 <noreply@anthropic.com>
This commit is contained in:
f-trycua
2025-11-19 00:00:23 +01:00
parent 6ee76fbe15
commit e30f99bd25

View File

@@ -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 ==="