Add Claude Code GitHub Workflow #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Claude Code Review | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, ready_for_review, reopened] | |
| # Optional: Only run on specific file changes | |
| # paths: | |
| # - "src/**/*.py" | |
| env: | |
| FFMPEG_VERSION: "8.0" | |
| jobs: | |
| claude-review: | |
| # Optional: Filter by PR author | |
| # if: | | |
| # github.event.pull_request.user.login == 'external-contributor' || | |
| # github.event.pull_request.user.login == 'new-developer' || | |
| # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| issues: read | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Set up Python | |
| run: uv python install 3.13 | |
| - name: Cache ffmpeg download | |
| uses: actions/cache@v4 | |
| id: cache-ffmpeg | |
| with: | |
| path: /opt/ffmpeg/ffmpeg-n${{ env.FFMPEG_VERSION }}-latest-linux64-gpl-${{ env.FFMPEG_VERSION }}.tar.xz | |
| key: ${{ runner.os }}-ffmpeg | |
| - name: Download ffmpeg if not cached | |
| if: steps.cache-ffmpeg.outputs.cache-hit != 'true' | |
| run: | | |
| echo "Downloading ffmpeg ${FFMPEG_VERSION}" | |
| wget -q https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n${{ env.FFMPEG_VERSION }}-latest-linux64-gpl-${{ env.FFMPEG_VERSION }}.tar.xz -P /opt/ffmpeg | |
| - name: Extract and install ffmpeg | |
| run: | | |
| echo "Extracting ffmpeg ${FFMPEG_VERSION}" | |
| sudo mkdir -p /opt/ffmpeg/extracted | |
| sudo tar --strip-components 1 -xf /opt/ffmpeg/ffmpeg-n${{ env.FFMPEG_VERSION }}-latest-linux64-gpl-${{ env.FFMPEG_VERSION }}.tar.xz -C /opt/ffmpeg/extracted | |
| echo "Installing ffmpeg ${FFMPEG_VERSION}" | |
| sudo cp /opt/ffmpeg/extracted/bin/ffmpeg /usr/bin/ffmpeg | |
| sudo cp /opt/ffmpeg/extracted/bin/ffprobe /usr/bin/ffprobe | |
| - name: Install dependencies | |
| run: uv sync --group dev | |
| - name: Run Claude Code Review | |
| id: claude-review | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' | |
| plugins: 'code-review@claude-code-plugins' | |
| prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' | |
| # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md | |
| # or https://code.claude.com/docs/en/cli-reference for available options | |
| claude_args: '--allowed-tools "Bash(uv run pytest:*),Bash(uv run ruff:*),Bash(uv run mypy:*),Bash(python -m ffmpeg_normalize:*),Bash(gh pr:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' |