Files
supabase/.github/workflows/docritic.yml

79 lines
2.5 KiB
YAML

name: Docritic
on:
push:
branches:
- feat/docritic-bot # TEMPORARY: Remove before merging
workflow_dispatch:
inputs:
guide_url:
description: 'Guide URL to test (e.g., https://supabase.com/docs/guides/database/testing)'
required: true
type: string
issue_comment:
types: [created]
concurrency:
group: docritic-${{ github.event.issue.number || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
issues: write
id-token: write
jobs:
test-guide:
# Run on workflow_dispatch OR issue_comment with @docritic (not PRs)
# Write access check is handled by claude-code-action itself
if: |
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(contains(github.event.comment.body, '@docritic') && !github.event.issue.pull_request)
runs-on: ubuntu-latest
environment: Docritic
timeout-minutes: 45
env:
WORKDIR: /tmp/workdir
ALLOWED_DOMAIN: supabase.com
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest
- name: Setup work directory
run: |
mkdir -p $WORKDIR
cp .github/docritic/CLAUDE.md $WORKDIR/CLAUDE.md
supabase init --workdir $WORKDIR
cd $WORKDIR && supabase start
timeout-minutes: 10
- name: Run docritic (issue comment)
if: github.event_name == 'issue_comment'
uses: anthropics/claude-code-action@v1
env:
CLAUDE_WORKING_DIR: ${{ env.WORKDIR }}
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
trigger_phrase: '@docritic'
claude_args: |
--allowedTools "Read(*),Bash(*),Write(${{ env.WORKDIR }}/*),Edit(${{ env.WORKDIR }}/*),WebFetch(domain:${{ env.ALLOWED_DOMAIN }})"
- name: Run docritic (manual dispatch or push)
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
uses: anthropics/claude-code-action@v1
env:
CLAUDE_WORKING_DIR: ${{ env.WORKDIR }}
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: '@docritic ${{ inputs.guide_url || ''https://supabase.com/docs/guides/database/testing'' }}'
claude_args: |
--allowedTools "Read(*),Bash(*),Write(${{ env.WORKDIR }}/*),Edit(${{ env.WORKDIR }}/*),WebFetch(domain:${{ env.ALLOWED_DOMAIN }})"