Class GitHubTools
java.lang.Object
com.example.github.GitHubTools
Reusable GitHub function tools backed by the
org.kohsuke:github-api client. Each returns
a Map with a "status" of "success" or "error". Reads
GITHUB_TOKEN from the environment; callers set dryRun to gate writes.
Defense in depth against prompt injection: the agent reads untrusted GitHub content (diffs,
file contents, issue/PR titles) and could be steered into harmful writes. Independently of the
prompt, the write tools (a) only target writeRepoOwner/writeRepoName when set,
(b) only modify Markdown files under docs/, and (c) are capped per run.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncreateIssue(String repoOwner, String repoName, String title, String body) createPullRequest(String repoOwner, String repoName, String baseBranch, List<String> filePaths, List<String> newContents, String title, String body) findDocIssues(String repoOwner, String repoName) findPullRequestsForIssue(String repoOwner, String repoName, int issueNumber) getChangedFiles(String repoOwner, String repoName, String startTag, String endTag, String pathFilter) getFileContent(String repoOwner, String repoName, String filePath) listReleases(String repoOwner, String repoName) searchCode(String repoOwner, String repoName, String query)
-
Field Details
-
dryRun
public static boolean dryRunWhen true,create_issue/create_pull_requestreturn a preview instead of writing. -
writeRepoOwner
When both are set,create_issue/create_pull_requestrefuse to write to any other repository, regardless of the owner/repo the model passes. Set by the entry point to the docs repository so untrusted content cannot redirect writes elsewhere. -
writeRepoName
-
-
Method Details
-
listReleases
-
getChangedFiles
-
getFileDiff
-
searchCode
-
getFileContent
-
createIssue
-
findDocIssues
-
findPullRequestsForIssue
-
createPullRequest
-