From 42ad733f1a3730490f477a77503a52904ac08f5a Mon Sep 17 00:00:00 2001 From: rndquu <119500907+rndquu@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:53:25 +0300 Subject: [PATCH] refactor: check that project exists --- .github/cloudflare-deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/cloudflare-deploy.sh b/.github/cloudflare-deploy.sh index 0c3a300..87d52cf 100755 --- a/.github/cloudflare-deploy.sh +++ b/.github/cloudflare-deploy.sh @@ -15,9 +15,9 @@ echo "Checking if project exists..." # Specifically scoped for public contributors to automatically deploy to our team Cloudflare account # Fetch the list of projects and check if the specific project exists -project_exists=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects" \ +project_exists=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/$REPOSITORY_NAME" \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ - -H "Content-Type: application/json" | jq -r ".result[] | select(.name == \"$REPOSITORY_NAME\") | .name") + -H "Content-Type: application/json" | jq -r ".result.name") if [ "$project_exists" == "$REPOSITORY_NAME" ]; then echo "Project already exists. Skipping creation..."