name: Changeset Review on: pull_request: paths: - ".changeset/*.md" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.head_ref != 'changeset-release/main' }} permissions: contents: read pull-requests: write issues: write id-token: write jobs: review-changesets: runs-on: ubuntu-latest if: github.event.pull_request.head.repo.full_name == github.repository steps: - name: Checkout changesets uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 0 persist-credentials: false sparse-checkout: | .changeset .github/opencode.json - name: Install OpenCode # pin OpenCode to 1.4.6 version as newer versions are causing ProviderInitError issues run: | npm install -g opencode-ai@1.4.6 cp .github/opencode.json ./opencode.json - name: Get changed changeset files id: changed-changesets uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 with: files: | .changeset/*.md files_ignore: | .changeset/README.md # Recover deleted files so the AI can read them (needed for Version Packages PRs) recover_deleted_files: ${{ github.event.pull_request.title == 'Version Packages' }} - name: Review Changesets with OpenCode id: opencode-review # Run for Version Packages PRs (which delete changesets) or regular PRs with new changesets if: github.event.pull_request.title == 'Version Packages' || steps.changed-changesets.outputs.added_files_count > 0 env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_AI_GATEWAY_ACCOUNT_ID }} CLOUDFLARE_GATEWAY_ID: ${{ secrets.CF_AI_GATEWAY_NAME }} CLOUDFLARE_API_TOKEN: ${{ secrets.CF_AI_GATEWAY_TOKEN }} DELETED_FILES: ${{ steps.changed-changesets.outputs.deleted_files }} ADDED_FILES: ${{ steps.changed-changesets.outputs.added_files }} run: | opencode --model "cloudflare-ai-gateway/workers-ai/@cf/moonshotai/kimi-k2.6" run --print-logs \ "Review the changeset files in this PR. For \"Version Packages\" PRs, review: ${DELETED_FILES} For regular PRs, review: ${ADDED_FILES} Read \`.changeset/README.md\` for guidelines, then validate: 1. **Version Type**: Accept the author's choice of patch/minor unless clearly incorrect 2. **Changelog Quality**: Meaningful descriptions (examples encouraged but not required for features) 3. **Markdown Headers**: No h1/h2/h3 headers (breaks changelog formatting) 4. **Analytics**: If the change collects more analytics, it should be a minor even though there is no user-visible change 5. **Dependabot**: Do not validate dependency update changesets for create-cloudflare 6. **Experimental features**: Changesets for experimental features should include note on how users can opt in. If all changesets pass, just output \"✅ All changesets look good\" - no need for a detailed checklist. Do not review other files, only the changesets. This is specifically a changeset review action. If there are issues, output \"⚠️ Issues found\" followed by the specific problems. Write your review to changeset-review.md." - name: Post review comment if: steps.opencode-review.outcome == 'success' uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3 with: header: changeset-review path: changeset-review.md - name: Skip notice if: github.event.pull_request.title != 'Version Packages' && steps.changed-changesets.outputs.added_files_count == 0 run: | echo "No new changesets to review (only minor edits to pre-existing changesets detected)"