Skip to content

Commit

Permalink
fix: extract port from base url if api url is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehsan Mirzarazi committed Feb 16, 2024
1 parent 30c8b80 commit 7d243b2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ jobs:
- name: Extract port from cypress.json
id: vars
run: |
apiUrl=$(jq -r '.env.apiUrl' ./cypress.json)
apiUrl=$(jq -r '.env.apiUrl // .baseUrl // empty' ./cypress.json)
if [[ -z "$apiUrl" ]]; then
echo "API URL or Base URL not found in cypress.json."
exit 1
fi
port=$(echo $apiUrl | grep -o '[0-9]\+')
if [[ -z "$port" ]]; then
echo "Port not found in URL."
exit 1
fi
echo "Extracted port: $port"
echo "::set-output name=port::$port"
- name: Run tests
Expand Down Expand Up @@ -58,8 +66,16 @@ jobs:
- name: Extract port from cypress.json
id: vars
run: |
apiUrl=$(jq -r '.env.apiUrl' ./cypress.json)
apiUrl=$(jq -r '.env.apiUrl // .baseUrl // empty' ./cypress.json)
if [[ -z "$apiUrl" ]]; then
echo "API URL or Base URL not found in cypress.json."
exit 1
fi
port=$(echo $apiUrl | grep -o '[0-9]\+')
if [[ -z "$port" ]]; then
echo "Port not found in URL."
exit 1
fi
echo "Extracted port: $port"
echo "::set-output name=port::$port"
- name: Run tests
Expand Down

0 comments on commit 7d243b2

Please sign in to comment.