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:
parent
a994d4dbe7
commit
1a6b49998b
1 changed files with 7 additions and 3 deletions
10
.github/workflows/release-mcp-server.yml
vendored
10
.github/workflows/release-mcp-server.yml
vendored
|
|
@ -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}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue