name: "Claude PR Review" description: "Reviews a PR using Claude" inputs: ANTHROPIC_API_KEY: description: "The API key for the anthropic API" required: true GITEA_URL: description: "The URL of the Gitea instance" required: true GITEA_CLAUDE_TOKEN: description: "The token of the claude account for the Gitea instance" required: true runs: using: "composite" steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.ref }} fetch-tags: true - name: Check if last commit is from Renovate Bot id: check-renovate run: | AUTHOR=$(git log -1 --pretty=format:'%an') echo "Author is $AUTHOR" echo "author=$AUTHOR" >> "$GITHUB_OUTPUT" - name: Set Tea Version id: tea_version run: echo "version=0.9.2" >> $GITHUB_OUTPUT # Check for the latest version - name: Download Tea CLI run: | TEA_VERSION=$(echo "${{ steps.tea_version.outputs.version }}") wget "https://gitea.com/gitea/tea/releases/download/v${TEA_VERSION}/tea-${TEA_VERSION}-linux-amd64" -O tea chmod +x tea mv tea /usr/local/bin/tea - name: Verify Tea Installation run: tea --version - name: Add Gitea Login env: GITEA_URL: ${{ inputs.GITEA_URL }} GITEA_TOKEN: ${{ inputs.GITEA_CLAUDE_TOKEN }} run: | tea login add --name mygitea --url "$GITEA_URL" --token "$GITEA_TOKEN" - name: Install bun uses: oven-sh/setup-bun@v2 - name: Install claude code run: bun i -g @anthropic-ai/claude-code - name: Claude PR Review if: steps.check-renovate.outputs.author != 'Renovate Bot' continue-on-error: true env: ANTHROPIC_API_KEY: ${{ inputs.ANTHROPIC_API_KEY }} PR_NUMBER: ${{ github.event.number }} run: | claude --allowedTools "Bash(tea:*)" --allowedTools "Bash(git:*) Read Grep WebFetch Glob LS" -p "You are a code review assistant. Your task is to review the changes in Pull Request #${PR_NUMBER}. All relevant changes can be seen by looking at the git diff HEAD...main (NEVER EVER REVIEW ALL THE CODE ONLY THE ONE FROM THE DIFF you can use the rest as context) or using the tea cli which you can use and we are on gitea. Also make sure to only review the changes in this pull request Only provide constructive feedback on the quality, correctness, readability, and potential issues in the code. Do not make any changes or suggest complete rewrites—just review what is there. Once you are done with your review, post your feedback as a reject or review on the pull request using the following exact format: tea \"\" ${PR_NUMBER} \"\" Make sure the comment is clear, professional, and helpful. Only run the tea comment command once you're finished reviewing all changes. AND MOST IMPORTANDLY ONLY REVIEW THE DIFF FROM THE CURRENT STATE TO THE MAIN BRANCH TO GET THAT USE GIT DIFF You may also use the tea cli to find out various things about the pull request Don't be too strict Also MAKE SURE TO ALWAYS MENTION WHAT FILES AND LINE NUMBERS ARE WRONG"