8000 docs: add a new github action that automatically adds a docs preview by EdwardAngert · Pull Request #17282 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

docs: add a new github action that automatically adds a docs preview #17282

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 18 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
89ac7c1
new docs preview action
EdwardAngert Apr 7, 2025
ec2b3bd
enhance: implement GitHub Actions best practices for docs-preview-lin…
EdwardAngert Apr 7, 2025
57cec51
feat: add docs-analysis composite action
EdwardAngert Apr 7, 2025
e26a937
enhance: improve docs-analysis composite action with best practices
EdwardAngert Apr 7, 2025
a4d3d94
feat: integrate docs-analysis with docs-preview-link workflow
EdwardAngert Apr 7, 2025
ea54314
feat: enhance docs-analysis action security and error handling
EdwardAngert Apr 7, 2025
2e5d26d
feat: enhance docs-ci workflow with security and metrics
EdwardAngert Apr 7, 2025
69515e6
fix: resolve YAML formatting issues in docs-analysis action
EdwardAngert Apr 7, 2025
13d9d7d
chore: add analyze_docs.py script for docs analysis
EdwardAngert Apr 7, 2025
7d62132
fix: resolve duplicate step ID in docs-analysis action
EdwardAngert Apr 7, 2025
7e150f2
fix: relax branch name validation in docs-analysis action
EdwardAngert Apr 7, 2025
e5fa379
fix: resolve regex syntax error in branch validation
EdwardAngert Apr 7, 2025
721f4f0
attempt to fix yaml issue
EdwardAngert Apr 7, 2025
b0f4315
attempt to fix yaml issue
EdwardAngert Apr 7, 2025
6b4f62c
fix: use proper variable expansion in Bash here-docs for Markdown links
EdwardAngert Apr 7, 2025
5b7ef4f
Merge branch 'main' into docs-preview-action
EdwardAngert Apr 7, 2025
d8ec639
fix: force GitHub Actions to use latest version of docs-analysis action
EdwardAngert Apr 8, 2025
4c93df1
fix: simplify docs-preview workflow (#17292)
EdwardAngert Apr 8, 2025
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
Next Next commit
chore: add analyze_docs.py script for docs analysis
- Add external Python script for document structure analysis
- Improves maintainability by separating Python code from YAML
- Handles document heading counts and title extraction
- Includes error handling for corrupted files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
  • Loading branch information
EdwardAngert and claude committed Apr 7, 2025
commit 13d9d7d73837959b6f09f7a4a751a06c264c136d
44 changes: 44 additions & 0 deletions .github/actions/docs-analysis/analyze_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
import sys
import json
import os
import re

files_to_analyze = sys.stdin.read().strip().split('\n')
doc_structure = {}

for file_path in files_to_analyze:
if not file_path or not file_path.endswith('.md') or not os.path.isfile(file_path):
continue

try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()

# Extract title (first h1)
title_match = re.search(r'^# (.+)$', content, re.MULTILINE)
title = title_match.group(1) if title_match else 'Untitled'

# Count headings
h1_count = len(re.findall(r'^# ', content, re.MULTILINE))
h2_count = len(re.findall(r'^## ', content, re.MULTILINE))
h3_count = len(re.findall(r'^### ', content, re.MULTILINE))

doc_structure[file_path] = {
'title': title,
'headings': {
'h1': h1_count,
'h2': h2_count,
'h3': h3_count
}
}

print(f'Analyzed {file_path}: H1={h1_count}, H2={h2_count}, H3={h3_count}, Title="{title}"', file=sys.stderr)
except Exception as e:
print(f'Error analyzing {file_path}: {str(e)}', file=sys.stderr)

# Write JSON output
with open('.github/temp/doc_structure.json', 'w', encoding='utf-8') as f:
json.dump(doc_structure, f, indent=2)

print(json.dumps(doc_structure))
Loading
0