Skip to content

Commit c1894b4

Browse files
committed
ci: add automatic doc update workflow
1 parent 2062247 commit c1894b4

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/docs-update.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Docs Update
2+
3+
on:
4+
schedule:
5+
# Run every 4 hours
6+
- cron: "0 */4 * * *"
7+
workflow_dispatch: # Allow manual trigger for testing
8+
9+
jobs:
10+
update-docs:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetch full history to access commits
21+
22+
- name: Get recent commits
23+
id: commits
24+
run: |
25+
COMMITS=$(git log --since="4 hours ago" --pretty=format:"- %h %s" 2>/dev/null || echo "")
26+
if [ -z "$COMMITS" ]; then
27+
echo "No commits in the last 4 hours"
28+
echo "has_commits=false" >> $GITHUB_OUTPUT
29+
else
30+
echo "has_commits=true" >> $GITHUB_OUTPUT
31+
{
32+
echo "list<<EOF"
33+
echo "$COMMITS"
34+
echo "EOF"
35+
} >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Run opencode
39+
if: steps.commits.outputs.has_commits == 'true'
40+
uses: sst/opencode/github@latest
41+
env:
42+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
43+
with:
44+
model: opencode/gpt-5.2
45+
agent: docs
46+
prompt: |
47+
Review the following commits from the last 4 hours and identify any new features that may need documentation.
48+
49+
<recent_commits>
50+
${{ steps.commits.outputs.list }}
51+
</recent_commits>
52+
53+
Steps:
54+
1. For each commit that looks like a new feature or significant change:
55+
- Read the changed files to understand what was added
56+
- Check if the feature is already documented in packages/docs/
57+
2. If you find undocumented features:
58+
- Update the relevant documentation files in packages/docs/
59+
- Follow the existing documentation style and structure
60+
- Make sure to document the feature clearly with examples where appropriate
61+
3. If all new features are already documented, report that no updates are needed
62+
63+
Focus on user-facing features and API changes. Skip internal refactors, bug fixes, and test updates unless they affect user-facing behavior.

0 commit comments

Comments
 (0)