From dad01899fa71409a407f68b6f92de79768296e53 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:18:12 +0900 Subject: [PATCH] fix: truncate name to 63 characters to respect RFC 1035 --- .github/workflows/worker-deploy.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/worker-deploy.yml b/.github/workflows/worker-deploy.yml index 85d283f..0a3942c 100644 --- a/.github/workflows/worker-deploy.yml +++ b/.github/workflows/worker-deploy.yml @@ -22,10 +22,15 @@ jobs: - name: Update wrangler.toml Name Field run: | branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g') - # Make sure that it doesnt exceed 63 characters or it will break RFC 1035 - branch_name=$(echo "${branch_name}" | cut -c 1-63) - sed -i "s/^name = \"\(.*\)\"$/name = \"\1-${branch_name}\"/" wrangler.toml - echo $branch_name + # Extract base name from wrangler.toml + base_name=$(grep '^name = ' wrangler.toml | sed 's/^name = "\(.*\)"$/\1/') + # Concatenate branch name with base name + new_name="${base_name}-${branch_name}" + # Truncate the new name to 63 characters for RFC 1035 + new_name=$(echo "$new_name" | cut -c 1-63) + # Update the wrangler.toml file + sed -i "s/^name = .*/name = \"$new_name\"/" wrangler.toml + echo "Updated wrangler.toml name to: $new_name" - name: Deploy with Wrangler id: wrangler_deploy uses: cloudflare/wrangler-action@v3