Skip to content

Commit 154d0de

Browse files
authored
feat: add instant "Fix this" links to PR code reviews (#773)
* feat: add "Fix this" links to PR code reviews When Claude reviews PRs and identifies fixable issues, it now includes inline links that open Claude Code with the fix request pre-loaded. Format: [Fix this →](https://claude.ai/code?q=<URI_ENCODED_INSTRUCTIONS>&repo=<REPO>) This enables one-click fix requests directly from code review comments. * feat: add include_fix_links input to control Fix this links Adds a configurable input to enable/disable the "Fix this →" links in PR code reviews. Defaults to true for backwards compatibility.
1 parent 3ba9f7c commit 154d0de

File tree

8 files changed

+19
-1
lines changed

8 files changed

+19
-1
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ inputs:
9393
description: "Force tag mode with tracking comments for pull_request and issue events. Only applicable to pull_request (opened, synchronize, ready_for_review, reopened) and issue (opened, edited, labeled, assigned) events."
9494
required: false
9595
default: "false"
96+
include_fix_links:
97+
description: "Include 'Fix this' links in PR code review feedback that open Claude Code with context to fix the identified issue"
98+
required: false
99+
default: "true"
96100
path_to_claude_code_executable:
97101
description: "Optional path to a custom Claude Code executable. If provided, skips automatic installation and uses this executable instead. WARNING: Using an older version may cause problems if the action begins taking advantage of new Claude Code features. This input is typically not needed unless you're debugging something specific or have unique needs in your environment."
98102
required: false
@@ -180,6 +184,7 @@ runs:
180184
BOT_ID: ${{ inputs.bot_id }}
181185
BOT_NAME: ${{ inputs.bot_name }}
182186
TRACK_PROGRESS: ${{ inputs.track_progress }}
187+
INCLUDE_FIX_LINKS: ${{ inputs.include_fix_links }}
183188
ADDITIONAL_PERMISSIONS: ${{ inputs.additional_permissions }}
184189
CLAUDE_ARGS: ${{ inputs.claude_args }}
185190
ALL_INPUTS: ${{ toJson(inputs) }}

docs/usage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
| `claude_code_oauth_token` | Claude Code OAuth token (alternative to anthropic_api_key) | No\* | - |
5959
| `prompt` | Instructions for Claude. Can be a direct prompt or custom template for automation workflows | No | - |
6060
| `track_progress` | Force tag mode with tracking comments. Only works with specific PR/issue events. Preserves GitHub context | No | `false` |
61+
| `include_fix_links` | Include 'Fix this' links in PR code review feedback that open Claude Code with context to fix the identified issue | No | `true` |
6162
| `claude_args` | Additional [arguments to pass directly to Claude CLI](https://docs.claude.com/en/docs/claude-code/cli-reference#cli-flags) (e.g., `--max-turns 10 --model claude-4-0-sonnet-20250805`) | No | "" |
6263
| `base_branch` | The base branch to use for creating new branches (e.g., 'main', 'develop') | No | - |
6364
| `use_sticky_comment` | Use just one comment to deliver PR comments (only applies for pull_request event workflows) | No | `false` |

src/create-prompt/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,13 @@ ${eventData.eventName === "issue_comment" || eventData.eventName === "pull_reque
734734
- Reference specific code sections with file paths and line numbers${eventData.isPR ? `\n - AFTER reading files and analyzing code, you MUST call mcp__github_comment__update_claude_comment to post your review` : ""}
735735
- Formulate a concise, technical, and helpful response based on the context.
736736
- Reference specific code with inline formatting or code blocks.
737-
- Include relevant file paths and line numbers when applicable.
737+
- Include relevant file paths and line numbers when applicable.${
738+
eventData.isPR && context.githubContext?.inputs.includeFixLinks
739+
? `
740+
- When identifying issues that could be fixed, include an inline link: [Fix this →](https://claude.ai/code?q=<URI_ENCODED_INSTRUCTIONS>&repo=${context.repository})
741+
The query should be URI-encoded and include enough context for Claude Code to understand and fix the issue (file path, line numbers, branch name, what needs to change).`
742+
: ""
743+
}
738744
- ${eventData.isPR ? `IMPORTANT: Submit your review feedback by updating the Claude comment using mcp__github_comment__update_claude_comment. This will be displayed as your PR review.` : `Remember that this feedback must be posted to the GitHub comment using mcp__github_comment__update_claude_comment.`}
739745
740746
B. For Straightforward Changes:

src/github/context.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ type BaseContext = {
9595
allowedBots: string;
9696
allowedNonWriteUsers: string;
9797
trackProgress: boolean;
98+
includeFixLinks: boolean;
9899
};
99100
};
100101

@@ -150,6 +151,7 @@ export function parseGitHubContext(): GitHubContext {
150151
allowedBots: process.env.ALLOWED_BOTS ?? "",
151152
allowedNonWriteUsers: process.env.ALLOWED_NON_WRITE_USERS ?? "",
152153
trackProgress: process.env.TRACK_PROGRESS === "true",
154+
includeFixLinks: process.env.INCLUDE_FIX_LINKS === "true",
153155
},
154156
};
155157

test/install-mcp-server.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ describe("prepareMcpConfig", () => {
3737
allowedBots: "",
3838
allowedNonWriteUsers: "",
3939
trackProgress: false,
40+
includeFixLinks: true,
4041
},
4142
};
4243

test/mockContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const defaultInputs = {
2525
allowedBots: "",
2626
allowedNonWriteUsers: "",
2727
trackProgress: false,
28+
includeFixLinks: true,
2829
};
2930

3031
const defaultRepository = {

test/modes/detector.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe("detectMode with enhanced routing", () => {
2525
allowedBots: "",
2626
allowedNonWriteUsers: "",
2727
trackProgress: false,
28+
includeFixLinks: true,
2829
},
2930
};
3031

test/permissions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ describe("checkWritePermissions", () => {
7373
allowedBots: "",
7474
allowedNonWriteUsers: "",
7575
trackProgress: false,
76+
includeFixLinks: true,
7677
},
7778
});
7879

0 commit comments

Comments
 (0)