Skip to content

Commit bb9e393

Browse files
EdwardAngertclaude
andcommitted
fix: update actions and preview URL handling
- Update tj-actions/changed-files to use v45 tag instead of caret versioning - Fix preview URLs for branches with slashes by replacing with dashes - Ensure consistent branch name handling across docs-shared and docs-preview actions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 90a9ca8 commit bb9e393

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ runs:
166166
clean_path=$(echo "$clean_path" | tr -cd 'a-zA-Z0-9_./-')
167167
168168
# Get branch name for URLs
169-
BRANCH_NAME=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
169+
RAW_BRANCH_NAME=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
170+
# Replace slashes with dashes for the URL
171+
BRANCH_NAME=$(echo "$RAW_BRANCH_NAME" | sed 's|/|-|g' | sed 's|[^a-zA-Z0-9_-]|-|g')
170172
171173
# Generate preview URL with correct format
172174
url_path=$(echo "$clean_path" | sed 's/\.md$//')

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ runs:
125125
126126
- name: Get changed files
127127
id: changed-files
128-
uses: tj-actions/changed-files@^45
128+
uses: tj-actions/changed-files@v45
129129
with:
130130
files: |
131131
${{ inputs.docs-dir }}/**
@@ -592,7 +592,9 @@ runs:
592592
shell: bash
593593
run: |
594594
# Robust branch name extraction with fallbacks for CI environments
595-
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's/[^a-zA-Z0-9_-]/-/g')
595+
RAW_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")
596+
# Replace slashes with dashes for the URL
597+
BRANCH=$(echo "$RAW_BRANCH" | sed 's|/|-|g' | sed 's|[^a-zA-Z0-9_-]|-|g')
596598
# Store branch for other steps
597599
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
598600
echo "url=https://coder.com/docs/@$BRANCH" >> $GITHUB_OUTPUT

.github/workflows/docs-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Node
2929
uses: ./.github/actions/setup-node
3030

31-
- uses: tj-actions/changed-files@^45
31+
- uses: tj-actions/changed-files@v45
3232
id: changed-files
3333
with:
3434
files: |

.github/workflows/docs-preview.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Get changed files
3939
id: changed-files
40-
uses: tj-actions/changed-files@^45
40+
uses: tj-actions/changed-files@v45
4141
with:
4242
files: |
4343
docs/**

0 commit comments

Comments
 (0)