Skip to content

Commit 141bc98

Browse files
authored
Update agent-docusarus-dev.yml
1 parent 942281f commit 141bc98

File tree

1 file changed

+50
-148
lines changed

1 file changed

+50
-148
lines changed
Lines changed: 50 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,62 @@
1-
name: Claude Code Documentation Review
1+
name: Claude Auto Review
2+
23
on:
34
pull_request:
4-
branches:
5-
- main
6-
- dev
7-
- fix/homepage-updates
5+
types: [opened, synchronize]
6+
87
jobs:
9-
claude-review:
8+
auto-review:
109
runs-on: ubuntu-latest
11-
1210
permissions:
1311
contents: read
14-
pull-requests: write
15-
12+
pull-requests: read
13+
id-token: write
1614
steps:
17-
- name: Checkout code
15+
- name: Checkout repository
1816
uses: actions/checkout@v4
1917
with:
20-
fetch-depth: 2
21-
22-
- name: Fetch system prompt from private repo
23-
id: fetch-prompt
24-
env:
25-
GH_TOKEN: ${{ secrets.NETWRIX_PROMPT_REPO_TOKEN }}
26-
run: |
27-
echo "Fetching system prompt..."
28-
29-
RESPONSE=$(curl -s -w "\n%{http_code}" \
30-
-H "Authorization: token $GH_TOKEN" \
31-
-H "Accept: application/vnd.github.v3.raw" \
32-
https://api.github.com/repos/netwrix/action-agent-prompts/contents/docs-dev.md?ref=main)
33-
34-
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
35-
CONTENT=$(echo "$RESPONSE" | head -n-1)
36-
37-
if [ "$HTTP_CODE" != "200" ]; then
38-
echo "Failed to fetch system prompt (HTTP $HTTP_CODE)"
39-
exit 1
40-
fi
41-
42-
echo "$CONTENT" > /tmp/system-prompt.md
43-
echo "System prompt fetched successfully"
44-
45-
- name: Check for Docusaurus changes
46-
id: check-files
47-
run: |
48-
CHANGED_FILES=$(git diff --name-only HEAD~1)
49-
50-
DOCUSAURUS_FILES=$(echo "$CHANGED_FILES" | grep -E "(docusaurus\.config\.js|sidebars?\.js|babel\.config\.js|package\.json|\.github/|src/)" || true)
51-
52-
if [ -z "$DOCUSAURUS_FILES" ]; then
53-
echo "No Docusaurus infrastructure files changed. Skipping review."
54-
echo "skip_review=true" >> $GITHUB_OUTPUT
55-
else
56-
echo "skip_review=false" >> $GITHUB_OUTPUT
57-
echo "### 🎯 Docusaurus Files Changed" >> $GITHUB_STEP_SUMMARY
58-
echo '```' >> $GITHUB_STEP_SUMMARY
59-
echo "$DOCUSAURUS_FILES" >> $GITHUB_STEP_SUMMARY
60-
echo '```' >> $GITHUB_STEP_SUMMARY
61-
fi
62-
63-
- name: Create review prompt
64-
if: steps.check-files.outputs.skip_review != 'true'
65-
run: |
66-
cat > /tmp/review-prompt.txt << 'EOF'
67-
Review this pull request focusing exclusively on Docusaurus infrastructure and configuration files.
68-
69-
Analyze changes to:
70-
- docusaurus.config.js (site configuration, plugins, themes)
71-
- sidebars.js (navigation structure)
72-
- package.json (dependencies, scripts)
73-
- Build configuration files
74-
- Source code in src/ directory
75-
- GitHub Actions workflows
76-
77-
For each issue found, provide:
78-
1. Clear explanation of the problem
79-
2. Specific code suggestion with reasoning
80-
3. Potential impact on the documentation site
81-
82-
Ignore all .md and .mdx files - focus only on the technical infrastructure.
83-
EOF
18+
fetch-depth: 1
8419

85-
- name: Read system prompt for append
86-
if: steps.check-files.outputs.skip_review != 'true'
87-
id: read-prompt
88-
run: |
89-
SYSTEM_PROMPT=$(cat /tmp/system-prompt.md)
90-
echo "system_content<<EOF" >> $GITHUB_OUTPUT
91-
echo "$SYSTEM_PROMPT" >> $GITHUB_OUTPUT
92-
echo "EOF" >> $GITHUB_OUTPUT
93-
94-
- name: Run Claude Code Review
95-
if: steps.check-files.outputs.skip_review != 'true'
96-
id: claude-review
97-
uses: anthropics/claude-code-base-action@beta
20+
- name: Automatic PR Review
21+
uses: anthropics/claude-code-action@beta
9822
with:
99-
prompt_file: /tmp/review-prompt.txt
100-
append_system_prompt: ${{ steps.read-prompt.outputs.system_content }}
101-
allowed_tools: "Read,Grep,Glob,LS"
10223
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
103-
timeout_minutes: "15"
104-
max_turns: "20"
105-
model: "claude-sonnet-4-20250514"
106-
107-
- name: Post review summary (bash)
108-
if: steps.claude-review.conclusion == 'success'
109-
env:
110-
EXECUTION_FILE: ${{ steps.claude-review.outputs.execution_file }}
111-
GH_TOKEN: ${{ secrets.NETWRIX_PROMPT_REPO_TOKEN }}
112-
PR_NUMBER: ${{ github.event.pull_request.number }}
113-
run: |
114-
if [ ! -f "$EXECUTION_FILE" ]; then
115-
echo "No execution file found"
116-
exit 0
117-
fi
118-
119-
# Extract the last assistant message using jq - handle the nested structure
120-
REVIEW_CONTENT=$(jq -r '
121-
.[] |
122-
select(.type == "assistant") |
123-
.message.content[]? |
124-
select(.type == "text") |
125-
.text
126-
' "$EXECUTION_FILE" | tail -1)
127-
128-
if [ -z "$REVIEW_CONTENT" ]; then
129-
echo "No review content found"
130-
echo "Execution file contents:"
131-
cat "$EXECUTION_FILE" | jq '.' | head -100
132-
exit 0
133-
fi
134-
135-
# Create comment file with proper escaping
136-
cat > /tmp/comment.md << 'HEADER'
137-
## 🤖 Claude Docusaurus Review
138-
139-
HEADER
140-
141-
# Append the review content
142-
echo "$REVIEW_CONTENT" >> /tmp/comment.md
143-
144-
# Add footer
145-
cat >> /tmp/comment.md << 'FOOTER'
146-
147-
---
148-
149-
<sub>Automated review by Claude Code</sub>
150-
FOOTER
151-
152-
# Post comment using GitHub API
153-
jq -n --arg body "$(cat /tmp/comment.md)" '{body: $body}' | \
154-
curl -X POST \
155-
-H "Authorization: token $GH_TOKEN" \
156-
-H "Accept: application/vnd.github.v3+json" \
157-
"https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" \
158-
-d @-
159-
160-
echo "Review posted successfully"
24+
timeout_minutes: "60"
25+
max_turns: 150
26+
model: "claude-opus-4-20250514"
27+
direct_prompt: |
28+
Please review this pull request and provide comprehensive feedback on both code and documentation quality.
29+
30+
Focus on:
31+
32+
**Code & Configuration:**
33+
- Docusaurus configuration files (docusaurus.config.js, sidebars.js)
34+
- Custom React components and pages in /src
35+
- Plugin configurations and customizations
36+
- Build performance and optimization
37+
- Proper use of Docusaurus features (versioning, i18n, search)
38+
39+
**Technical Writing & Content:**
40+
- Clarity and accuracy of technical explanations
41+
- Consistent terminology and voice
42+
- Logical information architecture and content flow
43+
- Appropriate use of headings and document structure
44+
- Clear and actionable examples/code snippets
45+
46+
**Markdown & Docusaurus-specific Features:**
47+
- Proper use of Docusaurus MDX features (admonitions, tabs, code blocks)
48+
- Correct frontmatter metadata (title, description, keywords, slug)
49+
- Working internal links and references
50+
- Appropriate use of custom components in MDX
51+
- Image optimization and proper alt text
52+
53+
**Documentation Standards:**
54+
- Adherence to style guide and writing conventions
55+
- Proper API documentation format (if applicable)
56+
- Comprehensive but concise explanations
57+
- No ambiguous instructions or unclear references
58+
- Appropriate technical level for target audience
59+
60+
Provide specific, actionable feedback with suggestions for improvement.
61+
Use inline comments to highlight particular issues in the code or content.
62+
allowed_tools: "mcp__github__create_pending_pull_request_review,mcp__github__add_pull_request_review_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff"

0 commit comments

Comments
 (0)