Skip to content

Commit 6e7859f

Browse files
authored
Update agent-docusarus-dev.yml
1 parent 0442c83 commit 6e7859f

File tree

1 file changed

+19
-127
lines changed

1 file changed

+19
-127
lines changed

.github/workflows/agent-docusarus-dev.yml

Lines changed: 19 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -9,153 +9,45 @@ on:
99

1010
issue_comment:
1111
types: [created]
12-
13-
pull_request_review_comment:
14-
types: [created]
1512

1613
jobs:
1714
claude-review:
18-
# Only run if it's a PR or if the comment contains @claude
15+
# Only run on PRs or when someone comments @claude
1916
if: |
2017
github.event_name == 'pull_request' ||
21-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
22-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude'))
18+
(github.event_name == 'issue_comment' &&
19+
github.event.issue.pull_request &&
20+
contains(github.event.comment.body, '@claude'))
2321
2422
runs-on: ubuntu-latest
2523

26-
permissions:
27-
contents: read
28-
pull-requests: write
29-
issues: write
30-
3124
steps:
3225
- name: Checkout code
3326
uses: actions/checkout@v4
3427
with:
3528
fetch-depth: 0
3629

37-
# Optional: Fetch custom system prompt
38-
- name: Fetch custom system prompt
39-
id: custom-prompt
40-
continue-on-error: true
41-
env:
42-
TOKEN: ${{ secrets.NETWRIX_PROMPT_REPO_TOKEN }}
43-
run: |
44-
if [ -n "$TOKEN" ]; then
45-
echo "Attempting to fetch custom prompt..."
46-
curl -s -H "Authorization: token $TOKEN" \
47-
-H "Accept: application/vnd.github.v3.raw" \
48-
-o /tmp/system-prompt.txt \
49-
https://api.github.com/repos/netwrix/action-agent-prompts/contents/docs-dev.md?ref=main
50-
51-
if [ -s /tmp/system-prompt.txt ]; then
52-
echo "has_custom=true" >> $GITHUB_OUTPUT
53-
echo "✅ Custom prompt fetched"
54-
fi
55-
fi
56-
57-
# Prepare the review prompt
58-
- name: Prepare review prompt
59-
id: prepare-prompt
30+
- name: Prepare prompt
6031
run: |
6132
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
62-
# For PRs, create a comprehensive review prompt
63-
cat > /tmp/review-prompt.txt << 'EOF'
64-
You are reviewing a pull request for a Docusaurus-based documentation site.
65-
66-
Please review the changes and check for:
67-
1. Configuration Integrity: Ensure docusaurus.config.js changes are valid
68-
2. Sidebar Structure: Verify sidebar configurations are properly formatted
69-
3. Build Impact: Identify any changes that might affect the documentation build
70-
4. Link Validity: Check that internal links and references are correct
71-
5. Best Practices: Ensure changes follow Docusaurus best practices
72-
73-
Focus on non-markdown files that affect documentation infrastructure.
74-
Provide specific, actionable feedback with code suggestions where appropriate.
75-
EOF
76-
else
77-
# For comments, extract the user's request
78-
COMMENT="${{ github.event.comment.body }}"
79-
echo "${COMMENT//@claude/}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' > /tmp/review-prompt.txt
80-
fi
81-
82-
# Load system prompt if available
83-
- name: Prepare system prompt
84-
id: system-prompt
85-
run: |
86-
if [ -f /tmp/system-prompt.txt ]; then
87-
PROMPT=$(cat /tmp/system-prompt.txt)
33+
echo "Review this Docusaurus documentation PR for configuration and build issues." > /tmp/prompt.txt
8834
else
89-
PROMPT="You are a documentation expert specializing in Docusaurus sites. Focus on infrastructure, configuration, and build-related changes."
35+
# Extract comment after @claude
36+
echo "${{ github.event.comment.body }}" | sed 's/@claude//' > /tmp/prompt.txt
9037
fi
91-
92-
# GitHub Actions multiline output
93-
echo "content<<EOF" >> $GITHUB_OUTPUT
94-
echo "$PROMPT" >> $GITHUB_OUTPUT
95-
echo "EOF" >> $GITHUB_OUTPUT
9638
97-
# Run Claude with the correct model
98-
- name: Run Claude Code Review
99-
id: claude-review
39+
- name: Run Claude Review
10040
uses: anthropics/claude-code-base-action@beta
10141
with:
102-
prompt_file: /tmp/review-prompt.txt
103-
system_prompt: ${{ steps.system-prompt.outputs.content }}
104-
allowed_tools: |
105-
View
106-
Glob
107-
Grep
108-
Read
42+
prompt_file: /tmp/prompt.txt
43+
system_prompt: |
44+
You are reviewing a Docusaurus documentation site.
45+
Focus on: docusaurus.config.js, sidebar files, build configuration.
46+
Provide specific, actionable feedback.
47+
model: "claude-opus-4-20250514"
10948
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
110-
timeout_minutes: "15"
49+
# Allow all tools - Claude will have full capabilities
50+
# This includes file operations, searching, editing, etc.
51+
allowed_tools: ""
11152
max_turns: "10"
112-
model: "claude-opus-4-20250514" # Fixed model name
113-
114-
# Post results without needing GitHub App
115-
- name: Post review results
116-
if: always() && github.event_name == 'pull_request'
117-
uses: actions/github-script@v7
118-
with:
119-
github-token: ${{ secrets.GITHUB_TOKEN }}
120-
script: |
121-
const fs = require('fs');
122-
const executionFile = '${{ steps.claude-review.outputs.execution_file }}';
123-
124-
let reviewContent = '⚠️ Review could not be completed.';
125-
126-
if (fs.existsSync(executionFile)) {
127-
try {
128-
const content = fs.readFileSync(executionFile, 'utf8');
129-
const data = JSON.parse(content);
130-
131-
// Extract the last assistant message
132-
for (let i = data.length - 1; i >= 0; i--) {
133-
if (data[i].role === 'assistant' && data[i].content) {
134-
reviewContent = data[i].content;
135-
break;
136-
}
137-
}
138-
} catch (e) {
139-
console.error('Error reading results:', e);
140-
}
141-
}
142-
143-
await github.rest.issues.createComment({
144-
issue_number: context.issue.number,
145-
owner: context.repo.owner,
146-
repo: context.repo.repo,
147-
body: `## 🤖 Claude Documentation Review\n\n${reviewContent}\n\n---\n<sub>Generated by Claude Documentation Review</sub>`
148-
});
149-
150-
# Summary
151-
- name: Job Summary
152-
if: always()
153-
run: |
154-
echo "## Claude Review Summary" >> $GITHUB_STEP_SUMMARY
155-
echo "- Status: ${{ steps.claude-review.outputs.conclusion || 'Unknown' }}" >> $GITHUB_STEP_SUMMARY
156-
echo "- Trigger: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
157-
if [ -f /tmp/system-prompt.txt ]; then
158-
echo "- Custom Prompt: ✅ Loaded" >> $GITHUB_STEP_SUMMARY
159-
else
160-
echo "- Custom Prompt: ❌ Using default" >> $GITHUB_STEP_SUMMARY
161-
fi
53+
timeout_minutes: "15"

0 commit comments

Comments
 (0)