Repository navigation
Add Automated Documentation Sync Monitor #1730
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c3549c3
Add automated documentation sync monitor
kenrogers aa4ceb6
Update to use oauth token and remove some repos
kenrogers 7bbf441
Add sbtc to monitoring
kenrogers 7336f35
change permission to issues: write
kenrogers 7505212
Update workflow permissions and prCount
kenrogers d960272
Merge branch 'master' into docs-sync-monitor
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| name: Smart Docs Monitor | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 */6 * * *' # Run every 6 hours | ||
| workflow_dispatch: | ||
| inputs: | ||
| hours_back: | ||
| description: 'Hours to look back for merged PRs' | ||
| required: false | ||
| default: '6' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| monitor: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout docs repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Fetch merged PRs and create review batch | ||
| id: batch | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const fs = require('fs'); | ||
| const repos = fs.readFileSync('repos-to-monitor.txt', 'utf8') | ||
| .split('\n') | ||
| .filter(line => line.trim() && !line.startsWith('#')); | ||
|
|
||
| const hoursBack = parseInt('${{ github.event.inputs.hours_back || '6' }}'); | ||
| const since = new Date(Date.now() - hoursBack * 60 * 60 * 1000).toISOString(); | ||
|
|
||
| let batchSummary = '# Merged PRs to Review\n\n'; | ||
| let prCount = 0; | ||
|
|
||
| for (const repo of repos) { | ||
| const [owner, repoName] = repo.split('/'); | ||
|
|
||
| try { | ||
| const { data: pulls } = await github.rest.pulls.list({ | ||
| owner, | ||
| repo: repoName, | ||
| state: 'closed', | ||
| sort: 'updated', | ||
| direction: 'desc', | ||
| per_page: 30 | ||
| }); | ||
|
|
||
| const merged = pulls.filter(pr => | ||
| pr.merged_at && | ||
| new Date(pr.merged_at) > new Date(since) | ||
| ); | ||
|
|
||
| if (merged.length > 0) { | ||
| batchSummary += `## ${repo}\n\n`; | ||
|
|
||
| for (const pr of merged) { | ||
| batchSummary += `### PR #${pr.number}: ${pr.title}\n`; | ||
| batchSummary += `- **URL:** ${pr.html_url}\n`; | ||
| batchSummary += `- **Merged:** ${pr.merged_at}\n`; | ||
| batchSummary += `- **Diff:** ${pr.diff_url}\n`; | ||
| if (pr.body) { | ||
| batchSummary += `- **Description:** ${pr.body.substring(0, 200)}...\n`; | ||
| } | ||
| batchSummary += '\n'; | ||
| prCount++; | ||
| } | ||
| batchSummary += '\n'; | ||
| } | ||
| } catch (error) { | ||
| console.log(`Error with ${repo}:`, error.message); | ||
| } | ||
| } | ||
|
|
||
| fs.writeFileSync('pr-batch.md', batchSummary); | ||
| console.log(`Found ${prCount} merged PRs`); | ||
| return prCount; | ||
|
|
||
| - name: Analyze with Claude and create issues | ||
| if: steps.batch.outputs.result > 0 | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| prompt: | | ||
| Review the merged PRs listed in `pr-batch.md` and determine which ones require documentation updates. | ||
|
|
||
| **Your Process:** | ||
|
|
||
| 1. **Read pr-batch.md** to see all merged PRs | ||
|
|
||
| 2. **For each PR:** | ||
| - Fetch the actual diff from the diff_url (use curl or gh api) | ||
| - Analyze what code/functionality changed | ||
| - Determine if it affects user-facing features, APIs, or workflows | ||
|
|
||
| 3. **Review our documentation:** | ||
| - Check /concepts directory for all conceptual documentation | ||
| - Check /guides-and-tutorials directory for tutorials and how-to guides | ||
| - Check /reference directory for API and reference documentation | ||
| - Read README.md | ||
| - Look for setup/configuration guides | ||
|
|
||
| 4. **Create GitHub issues for PRs needing doc updates:** | ||
|
|
||
| Use this format: | ||
|
|
||
| **Title:** `[Docs Update] [repo-name] PR #123: Brief description` | ||
|
|
||
| **Body:** | ||
|
|
||
| ## Source PR | ||
| - Repository: [repo-name] | ||
| - PR: #123 - [PR title] | ||
| - URL: [PR URL] | ||
| - Merged: [date] | ||
|
|
||
| ## What Changed | ||
| [Clear summary of the functional changes] | ||
|
|
||
| ## Documentation Impact | ||
|
|
||
| ### Files Needing Updates | ||
| - [ ] `/path/to/file1.md` - [What needs to change] | ||
| - [ ] `/path/to/file2.md` - [What needs to change] | ||
| - [ ] `README.md` - [What needs to change] | ||
|
|
||
| ## Recommended Changes | ||
|
|
||
| ### In `/path/to/file1.md` | ||
| [Specific text to add/change with examples] | ||
|
|
||
| ### In `README.md` | ||
| [Specific text to add/change with examples] | ||
|
|
||
| ## Priority | ||
| [High/Medium/Low] - [Why] | ||
|
|
||
| --- | ||
| *Auto-generated by docs sync monitor* | ||
|
|
||
|
|
||
| Labels: `["documentation", "auto-generated", "sync-needed", "[repo-name]"]` | ||
|
|
||
| 5. **Optimization:** | ||
| - Skip PRs with only internal refactoring, tests, or CI changes | ||
| - Group multiple PRs affecting the same doc section into one issue if appropriate | ||
| - Prioritize user-facing changes (API, features, setup) | ||
| - Be specific - don't create vague "update docs" issues | ||
|
|
||
| **Important:** Only create issues for PRs that genuinely need documentation updates. Not every merged PR requires documentation changes. | ||
| claude_args: | | ||
| --max-turns 40 | ||
| --model claude-sonnet-4-20250514 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.