diff --git a/.github/workflows/update-instances.yml b/.github/workflows/update-instances.yml index 3eec4a9..c77c551 100644 --- a/.github/workflows/update-instances.yml +++ b/.github/workflows/update-instances.yml @@ -32,17 +32,19 @@ jobs: file="services-full.json" while read -r line; do - if [[ "$line" == "\"https://"* ]]; then - domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//") - ns=$(dig ns "$domain") - if [[ "$ns" == *"cloudflare"* ]]; then - echo "\"$domain\" using cloudflare, skipping..." - else - echo "$line" >> out.json - fi + if [[ "$line" == "\"https://"* ]]; then + domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//") + ns=$(dig ns "$domain" || true) + if [[ "$ns" == *"cloudflare"* ]]; then + echo "\"$domain\" using cloudflare, skipping..." + elif [ ${#ns} -eq 0 ]; then + echo "Unable to verify records for \"$domain\", skipping..." else - echo "$line" >> out.json + echo "$line" >> out.json fi + else + echo "$line" >> out.json + fi done <$file # Remove any trailing commas from new instance lists diff --git a/tools/un-cloudflare.sh b/tools/un-cloudflare.sh index 690dd73..b10178b 100755 --- a/tools/un-cloudflare.sh +++ b/tools/un-cloudflare.sh @@ -7,9 +7,11 @@ file="services-full.json" while read -r line; do if [[ "$line" == "\"https://"* ]]; then domain=$(echo "$line" | sed -e "s/^\"https:\/\///" -e "s/\",//" -e "s/\"//") - ns=$(dig ns "$domain") + ns=$(dig ns "$domain" || true) if [[ "$ns" == *"cloudflare"* ]]; then echo "\"$domain\" using cloudflare, skipping..." + elif [ ${#ns} -eq 0 ]; then + echo "Unable to verify records for \"$domain\", skipping..." else echo "$line" >> out.json fi @@ -22,5 +24,4 @@ done <$file sed -i '' -e ':begin' -e '$!N' -e 's/,\n]/\n]/g' -e 'tbegin' -e 'P' -e 'D' out.json cat out.json | jq --indent 2 . > services.json -rm out.json - +rm -f out.json