forked from ChrisWiles/claude-code-showcase
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathscheduled-claude-code-docs-sync.yml
More file actions
116 lines (96 loc) · 4.21 KB
/
scheduled-claude-code-docs-sync.yml
File metadata and controls
116 lines (96 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Scheduled - Documentation Sync
on:
schedule:
# Run on the 1st of every month at 9 AM UTC
- cron: '0 9 1 * *'
workflow_dispatch:
inputs:
days_back:
description: 'Number of days to look back for changes'
required: false
default: '30'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
docs-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for code changes in period
id: check-changes
run: |
DAYS_BACK="${{ github.event.inputs.days_back || '30' }}"
SINCE_DATE=$(date -d "-${DAYS_BACK} days" +%Y-%m-%d)
echo "Checking for changes since: $SINCE_DATE"
# Get changed code files (excluding docs themselves)
CHANGED_FILES=$(git log --since="$SINCE_DATE" --name-only --pretty=format: -- \
'*.ts' '*.tsx' '*.js' '*.jsx' \
':!*.test.*' ':!*.spec.*' ':!*.stories.*' \
| sort -u | grep -v '^$' | head -100)
if [ -z "$CHANGED_FILES" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No code changes found in the last $DAYS_BACK days"
else
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "Found $(echo "$CHANGED_FILES" | wc -l) changed files"
fi
echo "since_date=$SINCE_DATE" >> $GITHUB_OUTPUT
- name: Claude Documentation Sync
if: steps.check-changes.outputs.has_changes == 'true'
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
model: claude-opus-4-5-20251101
timeout_minutes: 60
base_branch: main
branch_prefix: claude/docs-sync-
track_progress: true
prompt: |
# Monthly Documentation Sync
You are running a scheduled documentation sync. Code has changed since ${{ steps.check-changes.outputs.since_date }}.
## Changed Files
The following code files have been modified:
```
${{ steps.check-changes.outputs.changed_files }}
```
## Your Tasks
1. **Analyze Changes**: Review the changed files to understand what functionality was added, modified, or removed.
2. **Find Related Documentation**: Search for documentation that might be affected:
- `/docs/` directory
- README.md files
- TSDoc comments in the code
3. **Check for Actual Problems**: For each code change, determine if existing docs are now WRONG:
- Do code examples still work?
- Are API signatures/types now incorrect?
- Are prop interfaces outdated?
4. **Fix Only What's Broken**: If you find documentation that is actually wrong:
- Fix incorrect code examples
- Update wrong API signatures and types
- Add docs ONLY for significant new features that have zero documentation
5. **Create a PR**: If you made any changes:
- Create a new branch from main
- Commit all documentation updates
- Create a PR with a summary of what was fixed
## CRITICAL Guidelines
- Documentation is a LIVING DOCUMENT - only fix things that are actually WRONG
- DO NOT add changelog-style entries
- ONLY update docs when they are incorrect or misleading
- If no problems are found, report that and DO NOT create a PR
claude_args: |
--max-turns 30
--allowedTools "Read,Write,Edit,Glob,Grep,Bash(git:*),Bash(gh:*)"
- name: Report no changes
if: steps.check-changes.outputs.has_changes == 'false'
run: |
echo "No code changes found in the last ${{ github.event.inputs.days_back || '30' }} days."
echo "Skipping documentation sync."