Skip to content

Commit e763f0b

Browse files
committed
fix
1 parent aee77fd commit e763f0b

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

.github/workflows/auto-update-ndc-lambda-sdk.yaml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,36 @@ jobs:
3737
- name: Get current version from context.ts
3838
id: current-version
3939
run: |
40+
echo "Debugging: Looking for version in context.ts"
41+
grep -n "NDC_NODEJS_LAMBDA_SDK_VERSION" src/app/context.ts || echo "Pattern not found"
42+
4043
CURRENT_VERSION=$(grep -E "const NDC_NODEJS_LAMBDA_SDK_VERSION = " src/app/context.ts | sed -E 's/.*"([^"]+)".*/\1/')
44+
45+
if [ -z "$CURRENT_VERSION" ]; then
46+
echo "❌ Failed to extract current version from context.ts"
47+
echo "File content around the version:"
48+
grep -A2 -B2 "NDC_NODEJS_LAMBDA_SDK_VERSION" src/app/context.ts || echo "No matches found"
49+
exit 1
50+
fi
51+
4152
echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
4253
echo "Current version in context.ts: $CURRENT_VERSION"
4354
4455
- name: Get latest release from GitHub API
4556
id: latest-release
4657
run: |
47-
LATEST_RELEASE=$(curl -s https://api.github.com/repos/hasura/ndc-nodejs-lambda/releases/latest | jq -r '.tag_name')
58+
echo "Debugging: Fetching latest release from GitHub API"
59+
API_RESPONSE=$(curl -s https://api.github.com/repos/hasura/ndc-nodejs-lambda/releases/latest)
60+
echo "API Response: $API_RESPONSE"
61+
62+
LATEST_RELEASE=$(echo "$API_RESPONSE" | jq -r '.tag_name')
63+
64+
if [ -z "$LATEST_RELEASE" ] || [ "$LATEST_RELEASE" = "null" ]; then
65+
echo "❌ Failed to extract latest release version"
66+
echo "API Response was: $API_RESPONSE"
67+
exit 1
68+
fi
69+
4870
echo "latest-version=$LATEST_RELEASE" >> $GITHUB_OUTPUT
4971
echo "Latest release: $LATEST_RELEASE"
5072
@@ -53,7 +75,22 @@ jobs:
5375
run: |
5476
CURRENT="${{ steps.current-version.outputs.current-version }}"
5577
LATEST="${{ steps.latest-release.outputs.latest-version }}"
56-
78+
79+
echo "Debugging version comparison:"
80+
echo "CURRENT: '$CURRENT'"
81+
echo "LATEST: '$LATEST'"
82+
83+
# Validate that we have non-empty versions
84+
if [ -z "$CURRENT" ] || [ "$CURRENT" = "null" ]; then
85+
echo "❌ Current version is empty or null"
86+
exit 1
87+
fi
88+
89+
if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then
90+
echo "❌ Latest version is empty or null"
91+
exit 1
92+
fi
93+
5794
if [ "$CURRENT" = "$LATEST" ]; then
5895
echo "needs-update=false" >> $GITHUB_OUTPUT
5996
echo "✅ Already up to date: $CURRENT"

0 commit comments

Comments
 (0)