Skip to content

Commit

Permalink
fix cname update conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuebert committed May 27, 2024
1 parent e795ecd commit 94b761d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/set_cname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
echo "Checking if the CNAME record already exists for subdomain: ${SUBDOMAIN}"
RECORD_ID=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/dns_records?type=CNAME&name=${SUBDOMAIN}.gen.dev" \
-H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
-H "Content-Type: application/json")
-H "Content-Type: application/json" | jq -r '.result[] | select(.name=="'"${SUBDOMAIN}"'") | .id')
if echo "$RECORD_RESPONSE" | grep -q '"count":0'; then
if [ -z "$RECORD_ID" ]; then
echo "No existing CNAME record found. Creating a new CNAME record for subdomain: ${SUBDOMAIN}"
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/dns_records" \
-H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
Expand Down

0 comments on commit 94b761d

Please sign in to comment.