mirror of
https://github.com/Respect/Validation.git
synced 2024-05-21 07:36:43 +02:00
Update updater workflows, remove countries outside ISO-3366-2, cleanup
This commit is contained in:
parent
1e2f75287c
commit
74dee73f65
1
.github/workflows/update-currency-codes.yaml
vendored
1
.github/workflows/update-currency-codes.yaml
vendored
|
@ -1,6 +1,7 @@
|
|||
name: Update currency codes
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
|
||||
|
|
1
.github/workflows/update-language-codes.yaml
vendored
1
.github/workflows/update-language-codes.yaml
vendored
|
@ -1,6 +1,7 @@
|
|||
name: Update language codes
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
|
||||
|
|
3
.github/workflows/update-tld.yaml
vendored
3
.github/workflows/update-tld.yaml
vendored
|
@ -1,8 +1,9 @@
|
|||
name: Update top-level domains
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
update-tld:
|
||||
|
|
|
@ -11,9 +11,9 @@ declare -r LIBRARY_DIRECTORY="library"
|
|||
|
||||
clone_repository()
|
||||
{
|
||||
echo "Cloning repository ${REPOSITORY_URL}"
|
||||
if ! test -d "$REPOSITORY_DIRECTORY"
|
||||
then
|
||||
echo "Cloning repository ${REPOSITORY_URL}"
|
||||
git clone --quiet "${REPOSITORY_URL}" "${REPOSITORY_DIRECTORY}"
|
||||
fi
|
||||
}
|
||||
|
@ -65,6 +65,10 @@ update_subdivision_codes()
|
|||
local last_country_code=""
|
||||
local last_country_rule=""
|
||||
|
||||
rm -rf data/iso_3166-2/*
|
||||
|
||||
echo "Updating subdivision codes using ISO 3166-2"
|
||||
|
||||
for index in $(seq 0 $[iso_3166_1_count - 1]); do
|
||||
local json=$(jq ".[][${index}]" < "${iso_3166_1_filename}")
|
||||
local alpha_1="$(jq ".alpha_2" <<< "${json}" | tr -d '"')"
|
||||
|
@ -89,26 +93,6 @@ update_subdivision_codes()
|
|||
echo " }
|
||||
}" >> "data/iso_3166-2/${alpha_1}.json"
|
||||
done
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
echo "Updating subdivision codes using ISO 3166-2"
|
||||
|
||||
for index in $(seq 0 $[iso_3166_2_count - 1]); do
|
||||
local json=$(jq ".[][${index}]" < "${iso_3166_2_filename}")
|
||||
local code=$(jq -r ".code" <<< "${json}")
|
||||
local name=$(jq -r ".name" <<< "${json}")
|
||||
|
||||
local current_country_code=$(cut --delimiter "-" --fields 1 <<< "${code}")
|
||||
|
||||
if [[ ${last_country_code} != ${current_country_code} ]]; then
|
||||
echo "- Updating ${current_country_code}"
|
||||
fi
|
||||
|
||||
last_country_code=${current_country_code}
|
||||
done
|
||||
}
|
||||
|
||||
clone_repository
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"source": "http://www.geonames.org/AN/administrative-division-netherlands-antilles.html",
|
||||
"country": "Netherlands Antilles",
|
||||
"subdivisions": []
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"source": "http://www.geonames.org/CS/administrative-division-serbia-and-montenegro.html",
|
||||
"country": "Serbia And Montenegro",
|
||||
"subdivisions": {
|
||||
"KOS": "Kosovo",
|
||||
"MON": "Montenegro",
|
||||
"SER": "Serbia",
|
||||
"VOJ": "Vojvodina"
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"source": "http://www.geonames.org/XK/administrative-division-kosovo.html",
|
||||
"country": "Kosovo",
|
||||
"subdivisions": []
|
||||
}
|
Loading…
Reference in a new issue