name: Marvin Context Protocol on: issue_comment: { types: [created] } pull_request_review_comment: { types: [created] } pull_request_review: { types: [submitted] } pull_request: { types: [opened, edited] } issues: { types: [opened, edited, assigned, labeled] } discussion: { types: [created, edited, labeled] } discussion_comment: { types: [created] } permissions: contents: write issues: write pull-requests: write discussions: write actions: read id-token: write jobs: marvin: if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/marvin')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '/marvin')) || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '/marvin')) || (github.event_name == 'pull_request' && contains(github.event.pull_request.body, '/marvin')) || (github.event_name == 'issues' && contains(github.event.issue.body, '/marvin')) || (github.event_name == 'discussion' && contains(github.event.discussion.body, '/marvin')) || (github.event_name == 'discussion_comment' && contains(github.event.comment.body, '/marvin')) || (github.event_name == 'issues' && github.event.action == 'assigned' && github.event.assignee.login == 'Marvin Context Protocol') || (github.event_name == 'issues' && github.event.action == 'labeled' && github.event.label.name == 'marvin') runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 # Install UV package manager - name: Install UV uses: astral-sh/setup-uv@v7 with: enable-cache: true cache-dependency-glob: "uv.lock" # Install project dependencies - name: Install dependencies run: uv sync --python 3.12 # Install pre-commit hooks automatically - name: Install pre-commit hooks run: | uv run pre-commit install echo "✅ Pre-commit hooks installed" - name: Generate Marvin App token id: marvin-token uses: actions/create-github-app-token@v2 with: app-id: ${{ secrets.MARVIN_APP_ID }} private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }} # Marvin Assistant - name: Run Marvin uses: anthropics/claude-code-action@v1 with: github_token: ${{ steps.marvin-token.outputs.token }} anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} trigger_phrase: "/marvin" allowed_bots: "*" claude_args: | --allowedTools WebSearch,WebFetch,Bash(uv:*),Bash(pre-commit:*),Bash(pytest:*),Bash(ruff:*),Bash(ty:*),Bash(git:*),Bash(gh:*),mcp__github__add_issue_comment,mcp__github__create_issue,mcp__github__get_issue,mcp__github__list_issues,mcp__github__search_issues,mcp__github__update_issue,mcp__github__update_issue_comment,mcp__github__create_pull_request,mcp__github__get_pull_request,mcp__github__get_pull_request_comments,mcp__github__get_pull_request_files,mcp__github__get_pull_request_reviews,mcp__github__get_pull_request_status,mcp__github__list_pull_requests,mcp__github__update_pull_request,mcp__github__update_pull_request_branch,mcp__github__update_pull_request_comment,mcp__github__merge_pull_request additional_permissions: | actions: read settings: | { "model": "claude-sonnet-4-5-20250929", "env": { "GH_TOKEN": "${{ steps.marvin-token.outputs.token }}" } }