70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
81 lines
2.8 KiB
YAML
81 lines
2.8 KiB
YAML
name: Bonk
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
pull_request_review_comment:
|
|
types: [created]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
bonk:
|
|
if: github.event.sender.type != 'Bot' && (contains(github.event.comment.body, '/bonk') || contains(github.event.comment.body, '@ask-bonk'))
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
permissions:
|
|
id-token: write
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
steps:
|
|
- name: Check if comment author is Cloudflare org member
|
|
run: |
|
|
STATUS=$(gh api \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"/orgs/cloudflare/members/${COMMENT_AUTHOR}" \
|
|
--silent -i 2>/dev/null | head -1 | awk '{print $2}') || true
|
|
if [ "$STATUS" != "204" ]; then
|
|
echo "User ${COMMENT_AUTHOR} is not a member of the Cloudflare organization"
|
|
exit 1
|
|
fi
|
|
echo "User ${COMMENT_AUTHOR} is a Cloudflare org member"
|
|
env:
|
|
GH_TOKEN: ${{ secrets.READ_ONLY_ORG_GITHUB_TOKEN }}
|
|
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- name: Build prompt with triggering comment
|
|
id: prompt
|
|
run: |
|
|
{
|
|
DELIMITER=$(openssl rand -hex 16)
|
|
echo "value<<$DELIMITER"
|
|
echo "You were invoked by @${COMMENT_AUTHOR} on ${COMMENT_URL}"
|
|
echo ""
|
|
echo "Their comment:"
|
|
echo '```'
|
|
echo "$COMMENT_BODY"
|
|
echo '```'
|
|
echo ""
|
|
echo "This is your task. Read it carefully and act on it."
|
|
echo "$DELIMITER"
|
|
} >> "$GITHUB_OUTPUT"
|
|
env:
|
|
COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
|
|
COMMENT_BODY: ${{ github.event.comment.body }}
|
|
COMMENT_URL: ${{ github.event.comment.html_url }}
|
|
|
|
- name: Run Bonk
|
|
uses: ask-bonk/ask-bonk/github@c39e982defd0114385df54e72012a3fc4333c4d4
|
|
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 }}
|
|
with:
|
|
model: "cloudflare-ai-gateway/anthropic/claude-opus-4-8"
|
|
variant: "high"
|
|
mentions: "/bonk,@ask-bonk"
|
|
permissions: write
|
|
agent: bonk
|
|
opencode_version: 1.15.13 # pin to this version as certain ones cause ProviderInitError issues
|
|
prompt: ${{ steps.prompt.outputs.value }}
|