Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/bonk-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Review

on:
pull_request_review_comment:
types: [created]

jobs:
review:
if: github.event.sender.type != 'Bot'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
issues: write
pull-requests: write
steps:
- name: Get PR number
id: pr-number
run: |
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT

- name: Verify PR exists
id: verify-pr
run: |
if gh api /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "::warning::PR #${{ github.event.pull_request.number }} not found, skipping review"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
if: steps.verify-pr.outputs.exists == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Bun
if: steps.verify-pr.outputs.exists == 'true'
uses: oven-sh/setup-bun@v2

- name: Install dependencies
if: steps.verify-pr.outputs.exists == 'true'
run: bun install --frozen-lockfile

- name: Get PR details
if: steps.verify-pr.outputs.exists == 'true'
id: pr-details
run: |
gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-number.outputs.number }} > /tmp/pr_data.json
echo "title=$(jq -r .title /tmp/pr_data.json)" >> $GITHUB_OUTPUT
echo "sha=$(jq -r .head.sha /tmp/pr_data.json)" >> $GITHUB_OUTPUT
{
echo 'body<<EOF'
jq -r .body /tmp/pr_data.json
echo EOF
} >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run Bonk
uses: ask-bonk/ask-bonk/github@main
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
with:
model: anthropic/claude-opus-4-5
mentions: '/review'
permissions: CODEOWNERS
agent: docs # use the Docs agent for reviews
prompt: |
Review PR #${{ steps.pr-number.outputs.number }} (title: ${{ steps.pr-details.outputs.title }}) for documentation quality.

<pr_description>
${{ steps.pr-details.outputs.body }}
</pr_description>

## Review focus

1. **Structure & navigation**: Is content logically organized? Are headings clear and hierarchical? Is information easy to find?

2. **Style guide compliance**: Check against https://developers.cloudflare.com/style-guide/ per the Docs agent. Watch for: contractions, product name capitalization, link formatting (relative paths with trailing slashes), correct component usage.

3. **Cross-linking**: Are related docs linked where helpful? Use meaningful link text (not "click here"). Link to relevant concepts, guides, and API references.

4. **Code examples**: For each code block, verify:
- Syntactically correct
- Focused on the problem being explained
- Comments explain "why" not "what"
- Uses correct components (TypeScriptExample, WranglerConfig, APIRequest, PackageManagers)

## Output format

Separate findings into:
- **Needs fixing**: Broken syntax, incorrect information, missing required elements
- **Suggestions**: Style improvements, better organization, enhanced clarity

Use `gh` CLI to comment on specific lines. Use code suggestions for high-confidence fixes. Leave the final review comment empty.

If the PR looks good, respond with only "LGTM!".
Loading