From a201555ce845c95eeaee24621c6230766ccd62bf Mon Sep 17 00:00:00 2001 From: hexqi Date: Mon, 1 Jun 2026 11:57:34 +0800 Subject: [PATCH 1/3] chore(ci): change deploy workflow backend input from environment choice to custom URL - Replace alpha/production dropdown with a string input for backend URL - Default to https://agent.bytedev.site/ - Allows any custom backend URL to be specified at dispatch time Co-Authored-By: Claude Opus 4.8 --- .github/workflows/deploy-gh-pages.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 4a934f490a..25c4f7f3ec 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -5,14 +5,11 @@ on: branches: [develop] workflow_dispatch: inputs: - environment: - description: 'Backend environment' + backend_url: + description: 'Backend Base URL (e.g. https://agent.bytedev.site/)' required: true - default: 'alpha' - type: choice - options: - - alpha - - production + default: 'https://agent.bytedev.site/' + type: string jobs: deploy-gh-pages: @@ -41,16 +38,11 @@ jobs: - name: add environment variable run: | - ENV=${{ github.event.inputs.environment || 'alpha' }} - VITE_ORIGIN_URL="https://agent-alpha.opentiny.design/" - if [ "$ENV" = "production" ]; then - VITE_ORIGIN_URL="https://agent.opentiny.design/" - fi + VITE_ORIGIN_URL="${{ github.event.inputs.backend_url || 'https://agent.bytedev.site/' }}" cat <> designer-demo/env/.env.alpha # ---- appended by CI (gh-pages) ---- VITE_ORIGIN=$VITE_ORIGIN_URL EOF - echo "DEPLOY_ENV=$ENV" echo "VITE_ORIGIN_URL=$VITE_ORIGIN_URL" - name: Run Build run: | From 294bafdcd59ad102dae5fa0f15098bb425c83aae Mon Sep 17 00:00:00 2001 From: hexqi Date: Mon, 1 Jun 2026 14:13:31 +0800 Subject: [PATCH 2/3] fix: Template injection --- .github/workflows/deploy-gh-pages.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 25c4f7f3ec..82bda8fcc3 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -37,13 +37,14 @@ jobs: run: pnpm install - name: add environment variable + env: + ENV_BACKEND_URL: ${{ github.event.inputs.backend_url || 'https://agent.bytedev.site/' }} run: | - VITE_ORIGIN_URL="${{ github.event.inputs.backend_url || 'https://agent.bytedev.site/' }}" cat <> designer-demo/env/.env.alpha # ---- appended by CI (gh-pages) ---- - VITE_ORIGIN=$VITE_ORIGIN_URL + VITE_ORIGIN=$ENV_BACKEND_URL EOF - echo "VITE_ORIGIN_URL=$VITE_ORIGIN_URL" + echo "VITE_ORIGIN_URL=$ENV_BACKEND_URL" - name: Run Build run: | set -eo pipefail From 25a2ec4ab2707c790da4e05be8e3e302086e8939 Mon Sep 17 00:00:00 2001 From: hexqi Date: Mon, 1 Jun 2026 17:14:27 +0800 Subject: [PATCH 3/3] fix(ci): add backend URL validation - Validate backend_url input: reject multiline values, enforce http(s) URL format without query/hash, normalize trailing slash --- .github/workflows/deploy-gh-pages.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 82bda8fcc3..8d30dd8888 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -40,6 +40,18 @@ jobs: env: ENV_BACKEND_URL: ${{ github.event.inputs.backend_url || 'https://agent.bytedev.site/' }} run: | + if [[ "$ENV_BACKEND_URL" == *$'\n'* || "$ENV_BACKEND_URL" == *$'\r'* ]]; then + echo "::error::backend_url must be a single-line value" + exit 1 + fi + + if [[ ! "$ENV_BACKEND_URL" =~ ^https?://[^[:space:]/?#:]+(:[0-9]+)?(/[^[:space:]?#]*)?$ ]]; then + echo "::error::backend_url must be an http(s) base URL without query or hash" + exit 1 + fi + + ENV_BACKEND_URL="${ENV_BACKEND_URL%/}/" + cat <> designer-demo/env/.env.alpha # ---- appended by CI (gh-pages) ---- VITE_ORIGIN=$ENV_BACKEND_URL @@ -59,4 +71,4 @@ jobs: keep_files: true force_orphan: false user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' + user_email: 'github-actions[bot]@users.noreply.github.com' \ No newline at end of file