]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ci: Use github MCP in claude review instead of gh command line tool
authorDaan De Meyer <daan@amutable.com>
Tue, 10 Mar 2026 09:58:27 +0000 (10:58 +0100)
committerDaan De Meyer <daan@amutable.com>
Tue, 10 Mar 2026 09:58:27 +0000 (10:58 +0100)
MCP was specifically made for AI and is available, so we might as well
use it.

.github/workflows/claude-review.yml

index f4a594770200c31cd5af876b67ec5dc90af9bf09..ce40dae45f83ccfac5d8ce8ad40814cae8a5862c 100644 (file)
@@ -123,8 +123,15 @@ jobs:
             --allowedTools "
                 Read,LS,Grep,Glob,Task,
                 Bash(cat:*),Bash(test:*),Bash(printf:*),Bash(jq:*),Bash(head:*),Bash(tail:*),
-                Bash(git:*),Bash(gh:*),Bash(grep:*),Bash(find:*),Bash(ls:*),Bash(wc:*),
+                Bash(git:*),Bash(grep:*),Bash(find:*),Bash(ls:*),Bash(wc:*),
                 Bash(diff:*),Bash(sed:*),Bash(awk:*),Bash(sort:*),Bash(uniq:*),
+                mcp__github__get_pull_request,
+                mcp__github__get_pull_request_diff,
+                mcp__github__get_pull_request_files,
+                mcp__github__get_pull_request_reviews,
+                mcp__github__get_pull_request_comments,
+                mcp__github__get_pull_request_status,
+                mcp__github__get_issue_comments,
                 mcp__github_ci__get_ci_status,
                 mcp__github_ci__get_workflow_run_details,
                 mcp__github_ci__download_job_log,
@@ -142,15 +149,19 @@ jobs:
 
               ## Phase 1: Gather context
 
-              Fetch the patch, PR title/body, and list of existing comments (top-level, inline, and reviews):
-              - `gh pr diff ${{ steps.pr.outputs.number }} --patch`
-              - `gh pr view ${{ steps.pr.outputs.number }} --json title,body`
-              - `gh api --paginate repos/${{ github.repository }}/issues/${{ steps.pr.outputs.number }}/comments`
-              - `gh api --paginate repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}/comments`
-              - `gh api --paginate repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}/reviews`
+              Use the GitHub MCP server tools to fetch PR data. For all tools, pass
+              owner `${{ github.repository_owner }}`, repo `${{ github.event.repository.name }}`,
+              and pullNumber/issue_number ${{ steps.pr.outputs.number }}:
+              - `mcp__github__get_pull_request_diff` to get the PR diff
+              - `mcp__github__get_pull_request` to get the PR title, body, and metadata
+              - `mcp__github__get_pull_request_comments` to get top-level PR comments
+              - `mcp__github__get_pull_request_reviews` to get PR reviews
 
-              Also look for an existing tracking comment (containing `<!-- claude-pr-review -->`)
-              in the top-level issue comments. If one exists, you will use it as the basis for
+              Also fetch issue comments using `mcp__github__get_issue_comments` with
+              issue_number ${{ steps.pr.outputs.number }}.
+
+              Look for an existing tracking comment (containing `<!-- claude-pr-review -->`)
+              in the issue comments. If one exists, you will use it as the basis for
               your `summary` in Phase 3.
 
               Check CI status for the PR head commit using `mcp__github_ci__get_ci_status`.
@@ -233,7 +244,7 @@ jobs:
                  - Do NOT reorder, reword, or remove existing items.
 
               Return the final JSON object with your `comments` array and `summary` string.
-              Do NOT attempt to post comments, call `gh`, or use any MCP tools to interact with the PR.
+              Do NOT attempt to post comments or use any MCP tools to modify the PR.
 
   post:
     runs-on: ubuntu-latest