docs-update.yml 2.4 KB

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