Skip to content

Commit 09f3632

Browse files
authored
Merge pull request #5638 from platformsh/fix-update-region
solve update regions issue
2 parents 48e4e58 + a01c879 commit 09f3632

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/update-regions-locations.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,26 @@ jobs:
2626

2727
- name: Download latest regions_location.json
2828
run: |
29-
# TODO: Replace the following line with your actual curl command
30-
platform api:curl regions | jq '[ .regions[] | select(.available and .private == false) | {"name": .id, "provider": .provider.name, "zone": .zone,"timezone": .timezone} ] | sort_by(.name)' > ./shared/data/regions_location.json
29+
regions_response="$(mktemp)"
30+
trap 'rm -f "${regions_response}"' EXIT
31+
32+
for attempt in {1..5}; do
33+
if platform api:curl regions > "${regions_response}"; then
34+
break
35+
fi
36+
37+
if [ "${attempt}" -eq 5 ]; then
38+
echo "::error::Unable to retrieve regions after ${attempt} attempts."
39+
exit 1
40+
fi
41+
42+
sleep_seconds=$((attempt * 30))
43+
echo "::warning::Unable to retrieve regions. Retrying in ${sleep_seconds}s. Attempt ${attempt} of 5 failed."
44+
platform clear-cache || true
45+
sleep "${sleep_seconds}"
46+
done
47+
48+
jq '[ .regions[] | select(.available and .private == false) | {"name": .id, "provider": .provider.name, "zone": .zone,"timezone": .timezone} ] | sort_by(.name)' "${regions_response}" > ./shared/data/regions_location.json
3149
3250
- name: Create Pull Request
3351
uses: peter-evans/create-pull-request@v6

0 commit comments

Comments
 (0)