Skip to content

Commit 7d243b2

Browse files
author
Ehsan Mirzarazi
committed
fix: extract port from base url if api url is not provided
1 parent 30c8b80 commit 7d243b2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/auto-merge.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,16 @@ jobs:
2828
- name: Extract port from cypress.json
2929
id: vars
3030
run: |
31-
apiUrl=$(jq -r '.env.apiUrl' ./cypress.json)
31+
apiUrl=$(jq -r '.env.apiUrl // .baseUrl // empty' ./cypress.json)
32+
if [[ -z "$apiUrl" ]]; then
33+
echo "API URL or Base URL not found in cypress.json."
34+
exit 1
35+
fi
3236
port=$(echo $apiUrl | grep -o '[0-9]\+')
37+
if [[ -z "$port" ]]; then
38+
echo "Port not found in URL."
39+
exit 1
40+
fi
3341
echo "Extracted port: $port"
3442
echo "::set-output name=port::$port"
3543
- name: Run tests
@@ -58,8 +66,16 @@ jobs:
5866
- name: Extract port from cypress.json
5967
id: vars
6068
run: |
61-
apiUrl=$(jq -r '.env.apiUrl' ./cypress.json)
69+
apiUrl=$(jq -r '.env.apiUrl // .baseUrl // empty' ./cypress.json)
70+
if [[ -z "$apiUrl" ]]; then
71+
echo "API URL or Base URL not found in cypress.json."
72+
exit 1
73+
fi
6274
port=$(echo $apiUrl | grep -o '[0-9]\+')
75+
if [[ -z "$port" ]]; then
76+
echo "Port not found in URL."
77+
exit 1
78+
fi
6379
echo "Extracted port: $port"
6480
echo "::set-output name=port::$port"
6581
- name: Run tests

0 commit comments

Comments
 (0)