docs-update.yml 2.6 KB

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