docs-update.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. name: Docs Update
  2. on:
  3. schedule:
  4. - cron: "0 */12 * * *"
  5. workflow_dispatch:
  6. env:
  7. LOOKBACK_HOURS: 4
  8. jobs:
  9. update-docs:
  10. if: github.repository == 'sst/opencode'
  11. runs-on: blacksmith-4vcpu-ubuntu-2404
  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. - name: Setup Bun
  22. uses: ./.github/actions/setup-bun
  23. - name: Get recent commits
  24. id: commits
  25. run: |
  26. COMMITS=$(git log --since="${{ env.LOOKBACK_HOURS }} hours ago" --pretty=format:"- %h %s" 2>/dev/null || echo "")
  27. if [ -z "$COMMITS" ]; then
  28. echo "No commits in the last ${{ env.LOOKBACK_HOURS }} hours"
  29. echo "has_commits=false" >> $GITHUB_OUTPUT
  30. else
  31. echo "has_commits=true" >> $GITHUB_OUTPUT
  32. {
  33. echo "list<<EOF"
  34. echo "$COMMITS"
  35. echo "EOF"
  36. } >> $GITHUB_OUTPUT
  37. fi
  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 ${{ env.LOOKBACK_HOURS }} hours and identify any new features that may need documentation.
  48. <recent_commits>
  49. ${{ steps.commits.outputs.list }}
  50. </recent_commits>
  51. Steps:
  52. 1. For each commit that looks like a new feature or significant change:
  53. - Read the changed files to understand what was added
  54. - Check if the feature is already documented in packages/web/src/content/docs/*
  55. 2. If you find undocumented features:
  56. - Update the relevant documentation files in packages/web/src/content/docs/*
  57. - Follow the existing documentation style and structure
  58. - Make sure to document the feature clearly with examples where appropriate
  59. 3. If all new features are already documented, report that no updates are needed
  60. 4. If you are creating a new documentation file be sure to update packages/web/astro.config.mjs too.
  61. Focus on user-facing features and API changes. Skip internal refactors, bug fixes, and test updates unless they affect user-facing behavior.
  62. Don't feel the need to document every little thing. It is perfectly okay to make 0 changes at all.
  63. Try to keep documentation only for large features or changes that already have a good spot to be documented.