Files
shockbot/README.md
T

3.3 KiB

shockbot

Self-hosted AI code review for Gitea, powered by Ollama. Tag @shockbot in a PR comment to trigger a review, or configure it to auto-review on every PR.

Based on pullfrog — simplified for self-hosted Gitea + Ollama setups.

Requirements

  • Gitea instance
  • Ollama instance reachable from your Gitea Actions runner
  • A Gitea bot account with repo read/write access

Setup

1. Create a bot account

Create a Gitea account for the bot (e.g. shockbot) and generate an access token with read:issue, write:issue, read:pull_request, write:pull_request scopes.

2. Add secrets to your repo

Secret Description
BOT_TOKEN Gitea access token for the bot account
OLLAMA_HOST URL of your Ollama instance (e.g. http://192.168.1.10:11434)

3. Add the workflow

Create .gitea/workflows/shockbot.yml in the repo you want reviewed:

name: Shockbot Review
on:
  pull_request:
    types: [opened, ready_for_review]
  issue_comment:
    types: [created]

permissions:
  contents: write
  pull-requests: write
  issues: write

jobs:
  review:
    if: |
      (github.event_name == 'pull_request' && !github.event.pull_request.draft) ||
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@shockbot'))
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Run shockbot (PR trigger)
        if: github.event_name == 'pull_request'
        uses: https://git.shockvpn.com/ShockVPN/shockbot@main
        with:
          prompt: "Review this pull request"
        env:
          BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
          OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
          GITEA_URL: https://git.shockvpn.com
          GITEA_PR_NUMBER: ${{ github.event.pull_request.number }}
          GITEA_PR_TITLE: ${{ github.event.pull_request.title }}

      - name: Run shockbot (mention trigger)
        if: github.event_name == 'issue_comment'
        uses: https://git.shockvpn.com/ShockVPN/shockbot@main
        with:
          prompt: ${{ github.event.comment.body }}
        env:
          BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
          OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
          GITEA_URL: https://git.shockvpn.com
          GITEA_PR_NUMBER: ${{ github.event.issue.number }}

Configuration

Three values need to be configured — the rest come from the event context (as shown in the workflow example above) or are set automatically by Gitea Actions.

Secret / env var Description
BOT_TOKEN Gitea access token for the bot account
OLLAMA_HOST URL of your Ollama instance
GITEA_URL URL of your Gitea instance

Model

Defaults to qwen3.6:35b. Override with the model input:

with:
  prompt: "Review this pull request"
  model: "llama3.1:70b"

Usage

  • Auto-review on PR open — the PR trigger fires automatically on new PRs
  • Manual trigger — comment @shockbot review on any PR to trigger a review on demand
  • Custom prompt — any comment mentioning @shockbot is passed as the prompt, so @shockbot review focusing on security works

License

MIT. Based on pullfrog/pullfrog, used under the MIT license.