mirror of
https://github.com/FlipsideCrypto/analytics-workflow-templates.git
synced 2026-02-06 11:17:52 +00:00
Extract common API headers to variable to avoid duplication
This commit is contained in:
parent
57c1587851
commit
8866434eef
9
.github/workflows/refresh_dds.yml
vendored
9
.github/workflows/refresh_dds.yml
vendored
@ -68,10 +68,12 @@ jobs:
|
||||
echo "Refreshing cache for resource: $RESOURCE_ID"
|
||||
echo "API URL: $API_URL"
|
||||
|
||||
# Common headers for API calls
|
||||
API_HEADERS=(-H "X-API-Key: ${{ secrets.DDS_API_KEY }}" -H "Content-Type: application/json")
|
||||
|
||||
# Make the API call and capture both response and HTTP status
|
||||
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$API_URL/api/v1/cache/refresh?resource_id=$RESOURCE_ID_ENCODED$FORCE_PARAM" \
|
||||
-H "X-API-Key: ${{ secrets.DDS_API_KEY }}" \
|
||||
-H "Content-Type: application/json")
|
||||
"${API_HEADERS[@]}")
|
||||
|
||||
# Split response and status code
|
||||
HTTP_STATUS=$(echo "$RESPONSE" | tail -n1)
|
||||
@ -118,8 +120,7 @@ jobs:
|
||||
|
||||
# Get job status
|
||||
STATUS_RESPONSE=$(curl -s -w "\n%{http_code}" -X GET "$API_URL/api/v1/cache/jobs?job_id=$JOB_ID" \
|
||||
-H "X-API-Key: ${{ secrets.DDS_API_KEY }}" \
|
||||
-H "Content-Type: application/json")
|
||||
"${API_HEADERS[@]}")
|
||||
|
||||
STATUS_HTTP_CODE=$(echo "$STATUS_RESPONSE" | tail -n1)
|
||||
STATUS_BODY=$(echo "$STATUS_RESPONSE" | head -n -1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user