Fix error handling bug in PyPI version fetch

The previous error handling was broken due to set -e causing
immediate exit, making the $? check unreachable.

Changes:
- Use set -eo pipefail for proper pipeline error handling
- Check command success with if ! command; then pattern
- Separate check for empty version string
- Both checks now properly reachable and functional

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Daniel Chalef 2025-10-30 23:40:07 -07:00
parent a994d4dbe7
commit 1a6b49998b

View file

@ -90,14 +90,18 @@ jobs:
id: graphiti
run: |
# Query PyPI for the latest graphiti-core version with error handling
set -e
GRAPHITI_VERSION=$(curl -sf https://pypi.org/pypi/graphiti-core/json | python -c "import sys, json; data=json.load(sys.stdin); print(data['info']['version'])" 2>&1)
set -eo pipefail
if [ -z "$GRAPHITI_VERSION" ] || [ "$?" -ne 0 ]; then
if ! GRAPHITI_VERSION=$(curl -sf https://pypi.org/pypi/graphiti-core/json | python -c "import sys, json; data=json.load(sys.stdin); print(data['info']['version'])"); then
echo "Error: Failed to fetch graphiti-core version from PyPI"
exit 1
fi
if [ -z "$GRAPHITI_VERSION" ]; then
echo "Error: Empty version returned from PyPI"
exit 1
fi
echo "graphiti_version=${GRAPHITI_VERSION}" >> $GITHUB_OUTPUT
echo "Latest Graphiti Core version from PyPI: ${GRAPHITI_VERSION}"