docs-update.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. if: github.repository == 'sst/opencode'
  10. runs-on: blacksmith-4vcpu-ubuntu-2404
  11. permissions:
  12. id-token: write
  13. contents: write
  14. pull-requests: write
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v4
  18. with:
  19. fetch-depth: 0 # Fetch full history to access commits
  20. - name: Setup Bun
  21. uses: ./.github/actions/setup-bun
  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. - name: Run opencode
  38. if: steps.commits.outputs.has_commits == 'true'
  39. uses: sst/opencode/github@latest
  40. env:
  41. OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
  42. with:
  43. model: opencode/gpt-5.2
  44. agent: docs
  45. prompt: |
  46. Review the following commits from the last 4 hours and identify any new features that may need documentation.
  47. <recent_commits>
  48. ${{ steps.commits.outputs.list }}
  49. </recent_commits>
  50. Steps:
  51. 1. For each commit that looks like a new feature or significant change:
  52. - Read the changed files to understand what was added
  53. - Check if the feature is already documented in packages/web/src/content/docs/*
  54. 2. If you find undocumented features:
  55. - Update the relevant documentation files in packages/web/src/content/docs/*
  56. - Follow the existing documentation style and structure
  57. - Make sure to document the feature clearly with examples where appropriate
  58. 3. If all new features are already documented, report that no updates are needed
  59. 4. If you are creating a new documentation file be sure to update packages/web/astro.config.mjs too.
  60. Focus on user-facing features and API changes. Skip internal refactors, bug fixes, and test updates unless they affect user-facing behavior.
  61. Don't feel the need to document every little thing. It is perfectly okay to make 0 changes at all.
  62. Try to keep documentation only for large features or changes that already have a good spot to be documented.