cloudflare/kumo

Public

mirrored from https://github.com/cloudflare/kumoAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
main

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/reviewer.yml

81lines · modecode

1name: Reviewer
2
3on:
4 pull_request_review_comment:
5 types: [created]
6
7concurrency:
8 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9 cancel-in-progress: false
10
11jobs:
12 reviewer:
13 if: github.event.sender.type != 'Bot'
14 runs-on: ubuntu-latest
15 permissions:
16 id-token: write
17 contents: read
18 issues: write
19 pull-requests: write
20 steps:
21 - name: Get PR number
22 id: pr-number
23 run: |
24 echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
25
26 - name: Verify PR exists
27 id: verify-pr
28 run: |
29 if gh api /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} > /dev/null 2>&1; then
30 echo "exists=true" >> $GITHUB_OUTPUT
31 else
32 echo "exists=false" >> $GITHUB_OUTPUT
33 echo "::warning::PR #${{ github.event.pull_request.number }} not found, skipping review"
34 fi
35 env:
36 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37
38 - name: Checkout repository
39 if: steps.verify-pr.outputs.exists == 'true'
40 uses: actions/checkout@v4
41 with:
42 fetch-depth: 1
43
44 - name: Get PR details
45 if: steps.verify-pr.outputs.exists == 'true'
46 id: pr-details
47 run: |
48 gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-number.outputs.number }} > /tmp/pr_data.json
49 echo "title=$(jq -r .title /tmp/pr_data.json)" >> $GITHUB_OUTPUT
50 echo "sha=$(jq -r .head.sha /tmp/pr_data.json)" >> $GITHUB_OUTPUT
51 {
52 echo 'body<<EOF'
53 jq -r .body /tmp/pr_data.json
54 echo EOF
55 } >> $GITHUB_OUTPUT
56 env:
57 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58
59 - name: Run Reviewer
60 if: steps.verify-pr.outputs.exists == 'true'
61 uses: ask-bonk/ask-bonk/github@8c7a8314f4f4865e2e41e5718dfabc4ab7a2274b # main
62 env:
63 CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_AI_GATEWAY_ACCOUNT_ID }}
64 CLOUDFLARE_GATEWAY_ID: ${{ secrets.CF_AI_GATEWAY_NAME }}
65 CLOUDFLARE_API_TOKEN: ${{ secrets.CF_AI_GATEWAY_TOKEN }}
66 with:
67 model: "cloudflare-ai-gateway/anthropic/claude-opus-4-6"
68 mentions: "/review"
69 permissions: write
70 # agent: reviewer
71 prompt: |
72 Review PR "${{ steps.pr-details.outputs.title }}" against this repo's conventions. Read AGENTS.md (repo root and packages/kumo/) before reviewing. Read full files for context — diffs alone are not enough. Run `pnpm lint` and `pnpm typecheck` to validate changes. Focus on: semantic token usage (kumo-* only, never raw Tailwind colors or dark: variants), cn() for className composition, forwardRef/displayName patterns, and ESM-only imports.
73
74 Use the gh CLI to leave inline comments on specific files and lines. Use code suggestions where you have high confidence in the fix — ensure they account for surrounding code (braces, indentation). ALWAYS leave the final "review" comment empty. Separate "Needs Fix" (bugs, type errors, broken conventions, security) from "Style" (suggestions, minor improvements). Flag only real problems — not formatting the linter handles, pre-existing issues, or hypothetical edge cases. If the PR is clean, say "LGTM!".
75
76 <pr_number>
77 ${{ steps.pr-number.outputs.number }}
78 </pr_number>
79 <pr_description>
80 ${{ steps.pr-details.outputs.body }}
81 </pr_description>
82