Skip to content

Commit 3231eb4

Browse files
authored
Improve nickname fetching from APS API
Refactor the nickname retrieval logic to handle different response types.
1 parent d71178b commit 3231eb4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,18 @@ jobs:
7474
7575
- name: Get APS app nickname
7676
run: |
77-
NICKNAME=$(curl -s -X GET \
77+
RESPONSE=$(curl -s -X GET \
7878
"$DA_BASE_URL/forgeapps/me" \
79-
-H "Authorization: Bearer $APS_TOKEN" | jq -r '.nickname')
80-
if [ "$NICKNAME" = "null" ] || [ -z "$NICKNAME" ]; then
79+
-H "Authorization: Bearer $APS_TOKEN")
80+
81+
NICKNAME=$(echo "$RESPONSE" | jq -r 'if type=="object" then .nickname elif type=="string" then . else empty end' 2>/dev/null)
82+
83+
if [ -z "$NICKNAME" ] || [ "$NICKNAME" = "null" ]; then
8184
echo "::error::Failed to get app nickname"
85+
echo "$RESPONSE"
8286
exit 1
8387
fi
88+
8489
echo "NICKNAME=$NICKNAME" >> "$GITHUB_ENV"
8590
8691
- name: Check if AppBundle exists

0 commit comments

Comments
 (0)