Skip to content

Commit 3e34ff8

Browse files
committed
\Update preview URL format to match coder.com docs\n\nFix the preview URL format to use the correct format for Coder docs:\n- Changed preview URL to use correct format: https://coder.com/docs/@BRANCH_NAME\n- Updated individual doc links to use same format\n- Marked vercel-domain parameter as deprecated\n\n\ud83e\udd16 Generated with [Claude Code](https://claude.ai/code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\
1 parent 7462139 commit 3e34ff8

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

.github/actions/docs-preview/action.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
required: false
1111
default: 'docs'
1212
vercel-domain:
13-
description: 'Vercel deployment domain'
13+
description: 'DEPRECATED - Previously for Vercel, now using different URL format'
1414
required: false
1515
default: 'coder-docs-git'
1616
changed-files:
@@ -101,21 +101,20 @@ runs:
101101
if: steps.docs-analysis.outputs.has_changes == 'true'
102102
shell: bash
103103
run: |
104-
# Get PR number for Vercel preview URL using GitHub event file
105-
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
104+
# Get PR branch name for Vercel preview URL
105+
BRANCH_NAME=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
106106
107-
# Input validation - ensure PR number is a number
108-
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
109-
echo "::error::Invalid PR number: $PR_NUMBER"
107+
# Input validation - ensure branch name is valid
108+
if [ -z "$BRANCH_NAME" ]; then
109+
echo "::error::Could not determine branch name"
110110
exit 1
111111
fi
112112
113-
# Generate and output Vercel preview URL with sanitized inputs
114-
VERCEL_DOMAIN="${{ inputs.vercel-domain }}"
115-
# Remove any dangerous characters from domain
116-
VERCEL_DOMAIN=$(echo "$VERCEL_DOMAIN" | tr -cd 'a-zA-Z0-9-.')
113+
# For debugging
114+
echo "Branch name: $BRANCH_NAME"
117115
118-
VERCEL_PREVIEW_URL="https://${VERCEL_DOMAIN}-${PR_NUMBER}.vercel.app"
116+
# Create the correct Vercel preview URL
117+
VERCEL_PREVIEW_URL="https://coder.com/docs/@$BRANCH_NAME"
119118
echo "url=$VERCEL_PREVIEW_URL" >> $GITHUB_OUTPUT
120119
121120
- name: Analyze manifest changes
@@ -151,11 +150,12 @@ runs:
151150
clean_path=${doc_path#./}
152151
clean_path=$(echo "$clean_path" | tr -cd 'a-zA-Z0-9_./-')
153152
154-
# Generate preview URL
153+
# Get branch name for URLs
154+
BRANCH_NAME=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
155+
156+
# Generate preview URL with correct format
155157
url_path=$(echo "$clean_path" | sed 's/\.md$//')
156-
VERCEL_DOMAIN="${{ inputs.vercel-domain }}"
157-
VERCEL_DOMAIN=$(echo "$VERCEL_DOMAIN" | tr -cd 'a-zA-Z0-9-.')
158-
preview_url="https://${VERCEL_DOMAIN}-${PR_NUMBER}.vercel.app/${url_path}"
158+
preview_url="https://coder.com/docs/@${BRANCH_NAME}/${url_path}"
159159
160160
# Extract doc title or use filename safely
161161
if [ -f "$doc_path" ]; then

0 commit comments

Comments
 (0)