88 paths-ignore :
99 - ' **.md'
1010 - ' **.mdx'
11+ <<<<<<< fix/homepage-updates
12+ jobs :
13+ claude-review :
14+ runs-on : ubuntu-latest
15+
16+ permissions :
17+ contents : read
18+ pull-requests : write
19+
20+ steps :
21+ - name : Checkout code
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 2
25+
26+ - name : Fetch system prompt from private repo
27+ id : fetch-prompt
28+ env :
29+ GH_TOKEN : ${{ secrets.NETWRIX_PROMPT_REPO_TOKEN }}
30+ run : |
31+ echo "Fetching system prompt..."
32+
33+ RESPONSE=$(curl -s -w "\n%{http_code}" \
34+ -H "Authorization: token $GH_TOKEN" \
35+ -H "Accept: application/vnd.github.v3.raw" \
36+ https://api.github.com/repos/netwrix/action-agent-prompts/contents/docs-dev.md?ref=main)
37+
38+ HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
39+ CONTENT=$(echo "$RESPONSE" | head -n-1)
40+
41+ if [ "$HTTP_CODE" != "200" ]; then
42+ echo "Failed to fetch system prompt (HTTP $HTTP_CODE)"
43+ exit 1
44+ fi
45+
46+ echo "$CONTENT" > /tmp/system-prompt.md
47+ echo "System prompt fetched successfully"
48+
49+ - name : Check for Docusaurus changes
50+ id : check-files
51+ run : |
52+ CHANGED_FILES=$(git diff --name-only HEAD~1)
53+
54+ DOCUSAURUS_FILES=$(echo "$CHANGED_FILES" | grep -E "(docusaurus\.config\.js|sidebars?\.js|babel\.config\.js|package\.json|\.github/|src/)" || true)
55+
56+ if [ -z "$DOCUSAURUS_FILES" ]; then
57+ echo "No Docusaurus infrastructure files changed. Skipping review."
58+ echo "skip_review=true" >> $GITHUB_OUTPUT
59+ else
60+ echo "skip_review=false" >> $GITHUB_OUTPUT
61+ echo "### 🎯 Docusaurus Files Changed" >> $GITHUB_STEP_SUMMARY
62+ echo '```' >> $GITHUB_STEP_SUMMARY
63+ echo "$DOCUSAURUS_FILES" >> $GITHUB_STEP_SUMMARY
64+ echo '```' >> $GITHUB_STEP_SUMMARY
65+ fi
66+
67+ - name : Create review prompt
68+ if : steps.check-files.outputs.skip_review != 'true'
69+ run : |
70+ cat > /tmp/review-prompt.txt << 'REVIEW_PROMPT_EOF'
71+ Review this pull request focusing exclusively on Docusaurus infrastructure and configuration files.
72+
73+ Analyze changes to:
74+ - docusaurus.config.js (site configuration, plugins, themes)
75+ - sidebars.js (navigation structure)
76+ - package.json (dependencies, scripts)
77+ - Build configuration files
78+ - Source code in src/ directory
79+ - GitHub Actions workflows
80+
81+ For each issue found, provide:
82+ 1. Clear explanation of the problem
83+ 2. Specific code suggestion with reasoning
84+ 3. Potential impact on the documentation site
85+
86+ Ignore all .md and .mdx files - focus only on the technical infrastructure.
87+ REVIEW_PROMPT_EOF
88+
89+ - name : Read system prompt for append
90+ if : steps.check-files.outputs.skip_review != 'true'
91+ id : read-prompt
92+ run : |
93+ SYSTEM_PROMPT=$(cat /tmp/system-prompt.md)
94+ echo "system_content<<EOF" >> $GITHUB_OUTPUT
95+ echo "$SYSTEM_PROMPT" >> $GITHUB_OUTPUT
96+ echo "EOF" >> $GITHUB_OUTPUT
97+
98+ - name : Run Claude Code Review
99+ if : steps.check-files.outputs.skip_review != 'true'
100+ id : claude-review
101+ uses : anthropics/claude-code-base-action@beta
102+ with :
103+ prompt_file : /tmp/review-prompt.txt
104+ append_system_prompt : ${{ steps.read-prompt.outputs.system_content }}
105+ allowed_tools : " Read,Grep,Glob,LS"
106+ anthropic_api_key : ${{ secrets.ANTHROPIC_API_KEY }}
107+ timeout_minutes : " 15"
108+ max_turns : " 20"
109+ model : " claude-sonnet-4-20250514"
110+
111+ - name : Post review summary (bash)
112+ if : steps.claude-review.conclusion == 'success'
113+ env :
114+ EXECUTION_FILE : ${{ steps.claude-review.outputs.execution_file }}
115+ GH_TOKEN : ${{ secrets.NETWRIX_PROMPT_REPO_TOKEN }}
116+ PR_NUMBER : ${{ github.event.pull_request.number }}
117+ run : |
118+ if [ ! -f "$EXECUTION_FILE" ]; then
119+ echo "No execution file found"
120+ exit 0
121+ fi
122+
123+ # Extract the last assistant message using jq
124+ REVIEW_CONTENT=$(jq -r '.[] | select(.role == "assistant") | .content' "$EXECUTION_FILE" | tail -1)
125+
126+ if [ -z "$REVIEW_CONTENT" ]; then
127+ echo "No review content found"
128+ exit 0
129+ fi
130+
131+ # Create comment file with proper escaping
132+ cat > /tmp/comment.md << 'HEADER'
133+ ## 🤖 Claude Docusaurus Rname: Claude Code Documentation Review
134+ on :
135+ pull_request :
136+ branches :
137+ - main
138+ - dev
139+ - fix/homepage-updates
140+ paths-ignore :
141+ - ' **.md'
142+ - ' **.mdx'
143+ =======
144+ >>>>>>> dev
11145jobs :
12146 claude-review :
13147 runs-on : ubuntu-latest
@@ -137,7 +271,31 @@ jobs:
137271
138272 # Create comment file with proper escaping
139273 cat > /tmp/comment.md << 'HEADER'
140- ## 🤖 Claude Docusaurus Review
274+ # # 🤖 Claude Docusaurus Review
275+
276+ HEADER
277+
278+ # Append the review content
279+ echo "$REVIEW_CONTENT" >> /tmp/comment.md
280+
281+ # Add footer
282+ cat >> /tmp/comment.md << 'FOOTER'
283+
284+ ---
285+
286+ <sub>Automated review by Claude Code</sub>
287+ FOOTER
288+
289+ # Post comment using GitHub API
290+ jq -n --arg body "$(cat /tmp/comment.md)" '{body : $body}' | \
291+ curl -X POST \
292+ -H "Authorization : token $GH_TOKEN" \
293+ -H "Accept : application/vnd.github.v3+json" \
294+ " https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" \
295+ -d @-
296+
297+ <<<<<<< fix/homepage-updates
298+ echo "Review posted successfully"eview
141299
142300 HEADER
143301
@@ -160,4 +318,7 @@ jobs:
160318 " https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" \
161319 -d @-
162320
163- echo "Review posted successfully"
321+ echo "Review posted successfully"
322+ =======
323+ echo "Review posted successfully"
324+ >>>>>>> dev
0 commit comments