|
28 | 28 | echo "βοΈ Token length: ${#token}" |
29 | 29 | echo "TOKEN=$token" >> $GITHUB_ENV |
30 | 30 |
|
31 | | - - name: π‘ Send GET request to prod |
32 | | - run: | |
33 | | - echo "π Sending GET to https://sentinel-content-validationapi-prod-bvgsc3hjhyeqangg.canadacentral-01.azurewebsites.net/" |
34 | | -
|
35 | | - # Check if TOKEN is set |
36 | | - if [ -z "$TOKEN" ]; then |
37 | | - echo "β TOKEN is not set. Make sure the OIDC token was fetched correctly." |
38 | | - exit 1 |
39 | | - fi |
40 | | -
|
41 | | - # Send the GET request and capture both response and HTTP status |
42 | | - response=$(curl -s -w "\n%{http_code}" -H "Authorization: Bearer $TOKEN" "https://sentinel-content-validationapi-prod-bvgsc3hjhyeqangg.canadacentral-01.azurewebsites.net/") |
43 | | - |
44 | | - # Split response and status |
45 | | - http_body=$(echo "$response" | sed '$d') |
46 | | - http_status=$(echo "$response" | tail -n1) |
47 | | -
|
48 | | - echo "π HTTP Status: $http_status" |
49 | | - echo "π Raw Response:" |
50 | | - echo "$http_body" |
51 | | -
|
52 | | - # Check if the response is valid JSON |
53 | | - if echo "$http_body" | jq . > /dev/null 2>&1; then |
54 | | - echo "βοΈ Parsed JSON:" |
55 | | - echo "$http_body" | jq . |
56 | | - else |
57 | | - echo "β οΈ Response is not valid JSON or is empty." |
58 | | - exit 1 |
59 | | - fi |
60 | | -
|
61 | | - # Fail the step if the HTTP status is not 2xx |
62 | | - if [[ "$http_status" != 2* ]]; then |
63 | | - echo "β Request failed with status $http_status" |
64 | | - exit 1 |
65 | | - fi |
66 | | -
|
67 | 31 | - name: π‘ Send GET request too prod |
68 | 32 | run: | |
69 | 33 | echo "π Sending GET to prod" |
|
76 | 40 | - name: π‘ Send GET request too dev |
77 | 41 | run: | |
78 | 42 | echo "π Sending GET to dev" |
79 | | - response=$(curl -s -H "Authorization: Bearer $TOKEN" "https://sentintel-content-dev-fue4ashcg9fnfge9.canadacentral-01.azurewebsites.net/") |
| 43 | + response=$(curl -s -H "Authorization: Bearer $TOKEN" "https://sentinel-content-validation-dev-edbve7bwfjbaa6cc.canadacentral-01.azurewebsites.net/") |
80 | 44 | echo "π Response JSON:" |
81 | 45 | echo "$response" | jq . |
82 | 46 | |
0 commit comments