10000 docs: test gh preview action on parameters note by EdwardAngert · Pull Request #17319 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

docs: test gh preview action on parameters note #17319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add direct links to changed documentation files
  • Loading branch information
EdwardAngert committed Apr 9, 2025
commit ebd1627ead6c7313bb080200377502a58b7bbc91
23 changes: 19 additions & 4 deletions .github/actions/docs-preview/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,31 @@ runs:
# Force to true for debugging
DOC_FILES_COUNT=1

# Format changed files for comment
FORMATTED_FILES=$(jq -r '.[] | select(startswith("${{ inputs.docs-dir }}/")) | "- `" + . + "`"' changed_files.json)
# Get branch name for URLs
BRANCH_NAME=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")

# Format changed files for comment with clickable links
FORMATTED_FILES=""
while read -r file_path; do
[ -z "$file_path" ] && continue

# Create direct link to file
# Remove .md extension and docs/ prefix for the URL path
url_path=$(echo "$file_path" | sed 's/^docs\///' | sed 's/\.md$//')
file_url="https://coder.com/docs/@${BRANCH_NAME}/${url_path}"

# Add the formatted line with link
FORMATTED_FILES="${FORMATTED_FILES}- [$file_path]($file_url)\n"
done < <(jq -r '.[] | select(startswith("${{ inputs.docs-dir }}/"))' changed_files.json)

# Add a minimum placeholder if no files found
if [ -z "$FORMATTED_FILES" ]; then
FORMATTED_FILES="- Test file - debugging workflow"
# Hardcode a test example that links directly to the parameters.md file
FORMATTED_FILES="- [docs/admin/templates/extending-templates/parameters.md](https://coder.com/docs/@${BRANCH_NAME}/admin/templates/extending-templates/parameters)\n"
fi

echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$FORMATTED_FILES" >> $GITHUB_OUTPUT
echo -e "$FORMATTED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Determine if docs have changed - force true for testing
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
## 📚 Docs Preview

Your documentation changes are available for preview at:
**🔗 [Vercel Preview](${{ steps.docs-preview.outputs.url }})**
**🔗 [Documentation Preview](${{ steps.docs-preview.outputs.url }})**

### Changed Documentation Files
${{ steps.docs-preview.outputs.changed_files }}
Expand Down
Loading
0