Skip to content

Commit 8a00a87

Browse files
lpcoxCopilot
andcommitted
fix(guard): correct backend enrichment tool names and args
- PR enrichment: change tool from 'get_pull_request' (doesn't exist) to 'pull_request_read' with method: 'get' and pullNumber arg. Without this fix, all PR enrichment calls silently failed, preventing trusted bot detection for github-actions[bot] authored PRs. - Issue enrichment: add missing method: 'get' parameter to issue_read calls. The MCP server requires this parameter. Both fixes ensure author_login and author_association are correctly fetched, enabling trusted bot detection to elevate github-actions[bot] items to writer integrity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b2b0527 commit 8a00a87

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

  • guards/github-guard/rust-guard/src/labels

guards/github-guard/rust-guard/src/labels/backend.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub fn is_repo_private_with_callback(
214214

215215
/// Determine whether a pull request is from a fork.
216216
///
217-
/// This helper calls `get_pull_request` through the provided backend callback,
217+
/// This helper calls `pull_request_read` through the provided backend callback,
218218
/// extracts `base.repo.full_name` and `head.repo.full_name`, and returns:
219219
/// - `Some(true)` if the PR is from a fork (head repo differs from base repo)
220220
/// - `Some(false)` if the PR is direct (same repository)
@@ -233,7 +233,8 @@ pub fn is_forked_pull_request_with_callback(
233233
let args = serde_json::json!({
234234
"owner": owner,
235235
"repo": repo,
236-
"pull_number": pull_number,
236+
"pullNumber": pull_number,
237+
"method": "get",
237238
});
238239

239240
let args_str = args.to_string();
@@ -244,7 +245,7 @@ pub fn is_forked_pull_request_with_callback(
244245
owner, repo, pull_number
245246
));
246247

247-
let len = match callback("get_pull_request", &args_str, &mut result_buffer) {
248+
let len = match callback("pull_request_read", &args_str, &mut result_buffer) {
248249
Ok(len) if len > 0 => len,
249250
Ok(_) => return None,
250251
Err(code) => {
@@ -294,13 +295,14 @@ pub fn get_pull_request_facts_with_callback(
294295
let args = serde_json::json!({
295296
"owner": owner,
296297
"repo": repo,
297-
"pull_number": pull_number,
298+
"pullNumber": pull_number,
299+
"method": "get",
298300
});
299301

300302
let args_str = args.to_string();
301303
let mut result_buffer = vec![0u8; SMALL_BUFFER_SIZE];
302304

303-
let len = match callback("get_pull_request", &args_str, &mut result_buffer) {
305+
let len = match callback("pull_request_read", &args_str, &mut result_buffer) {
304306
Ok(len) if len > 0 => len,
305307
_ => return None,
306308
};
@@ -370,6 +372,7 @@ pub fn get_issue_author_association_with_callback(
370372
"owner": owner,
371373
"repo": repo,
372374
"issue_number": issue_number,
375+
"method": "get",
373376
});
374377

375378
let args_str = args.to_string();
@@ -419,6 +422,7 @@ pub fn get_issue_author_info_with_callback(
419422
"owner": owner,
420423
"repo": repo,
421424
"issue_number": issue_number,
425+
"method": "get",
422426
});
423427

424428
let args_str = args.to_string();

0 commit comments

Comments
 (0)