Skip to content

Commit 74e12ec

Browse files
committed
Add Bonk GitHub workflows
1 parent 7f70445 commit 74e12ec

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: PR Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
jobs:
8+
review:
9+
# Skip Version Packages PRs (auto-generated by the changesets action) since they don't need a Bonk review
10+
if: |
11+
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name &&
12+
!(github.event.pull_request.base.repo.owner.login == 'cloudflare' && github.event.pull_request.head.ref == 'changeset-release/main') &&
13+
(
14+
github.event.pull_request.author_association == 'MEMBER' ||
15+
github.event.pull_request.author_association == 'COLLABORATOR' ||
16+
github.event.pull_request.author_association == 'OWNER'
17+
)
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22+
cancel-in-progress: false
23+
permissions:
24+
id-token: write
25+
contents: read
26+
issues: write
27+
pull-requests: write
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v7
31+
with:
32+
fetch-depth: 30
33+
34+
- name: Load review prompt
35+
id: prompt
36+
run: |
37+
{
38+
echo 'value<<EOF'
39+
echo "You are reviewing PR #${{ github.event.pull_request.number }} on ${{ github.repository }}."
40+
echo ""
41+
cat .github/bonk_reviewer.md
42+
echo EOF
43+
} >> "$GITHUB_OUTPUT"
44+
45+
- name: Run Bonk
46+
uses: ask-bonk/ask-bonk/github@24832587005550860c8ad13fd96519e731ca632a # main
47+
env:
48+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_AI_GATEWAY_ACCOUNT_ID }}
49+
CLOUDFLARE_GATEWAY_ID: ${{ secrets.CF_AI_GATEWAY_NAME }}
50+
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_AI_GATEWAY_TOKEN }}
51+
with:
52+
model: "cloudflare-ai-gateway/anthropic/claude-opus-4-8"
53+
variant: "high"
54+
forks: "false"
55+
permissions: write
56+
token_permissions: NO_PUSH
57+
opencode_version: 1.15.13 # pin to this version as certain ones cause ProviderInitError issues
58+
prompt: ${{ steps.prompt.outputs.value }}

.github/workflows/bonk.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Bonk
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
11+
cancel-in-progress: false
12+
13+
jobs:
14+
bonk:
15+
if: >-
16+
github.event.sender.type != 'Bot' &&
17+
(contains(github.event.comment.body, '/bonk') || contains(github.event.comment.body, '@ask-bonk')) &&
18+
(
19+
github.event.comment.author_association == 'MEMBER' ||
20+
github.event.comment.author_association == 'COLLABORATOR' ||
21+
github.event.comment.author_association == 'OWNER'
22+
)
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 60
25+
permissions:
26+
id-token: write
27+
contents: write
28+
issues: write
29+
pull-requests: write
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v7
33+
with:
34+
fetch-depth: 1
35+
36+
- name: Build prompt with triggering comment
37+
id: prompt
38+
run: |
39+
{
40+
DELIMITER=$(openssl rand -hex 16)
41+
echo "value<<$DELIMITER"
42+
echo "You were invoked by @${COMMENT_AUTHOR} on ${COMMENT_URL}"
43+
echo ""
44+
echo "Their comment:"
45+
echo '```'
46+
echo "$COMMENT_BODY"
47+
echo '```'
48+
echo ""
49+
echo "This is your task. Read it carefully and act on it."
50+
echo "$DELIMITER"
51+
} >> "$GITHUB_OUTPUT"
52+
env:
53+
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
54+
COMMENT_BODY: ${{ github.event.comment.body }}
55+
COMMENT_URL: ${{ github.event.comment.html_url }}
56+
57+
- name: Run Bonk
58+
uses: ask-bonk/ask-bonk/github@c39e982defd0114385df54e72012a3fc4333c4d4
59+
env:
60+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_AI_GATEWAY_ACCOUNT_ID }}
61+
CLOUDFLARE_GATEWAY_ID: ${{ secrets.CF_AI_GATEWAY_NAME }}
62+
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_AI_GATEWAY_TOKEN }}
63+
with:
64+
model: "cloudflare-ai-gateway/anthropic/claude-opus-4-8"
65+
variant: "high"
66+
mentions: "/bonk,@ask-bonk"
67+
permissions: write
68+
token_permissions: NO_PUSH
69+
agent: bonk
70+
opencode_version: 1.15.13 # pin to this version as certain ones cause ProviderInitError issues
71+
prompt: ${{ steps.prompt.outputs.value }}

0 commit comments

Comments
 (0)