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