Skip to content

Commit

Permalink
style: improve error message handling in endpoint check
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jun 20, 2024
1 parent 2cf6da8 commit c71fe24
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/actions/checkpoint-sync/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ runs:
check_endpoint() {
local path=$1
local accept_header=$2
local response=$(curl -s -o /dev/null -w "%{http_code}" -H "accept: ${accept_header}" "localhost:5555${path}")
if [[ $response -ge 200 && $response -lt 300 ]]; then
local response=$(curl -s -H "accept: ${accept_header}" "localhost:5555${path}")
local http_code=$(curl -s -o /dev/null -w "%{http_code}" -H "accept: ${accept_header}" "localhost:5555${path}")
if [[ $http_code -ge 200 && $http_code -lt 300 ]]; then
echo $response
return 0
else
echo "Endpoint ${path} with accept header ${accept_header} is not available."
Expand Down

0 comments on commit c71fe24

Please sign in to comment.