|
| 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