Fix agent mode to include GitHub MCP server with proper token

This commit is contained in:
km-anthropic
2025-08-11 13:46:35 -07:00
parent d7a5b003e4
commit c03f13d243
2 changed files with 51 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ export const agentMode: Mode = {
return false;
},
async prepare({ context }: ModeOptions): Promise<ModeResult> {
async prepare({ context, githubToken }: ModeOptions): Promise<ModeResult> {
// Agent mode handles automation events and any event with explicit prompts
// TODO: handle by createPrompt (similar to tag and review modes)
@@ -72,7 +72,7 @@ export const agentMode: Mode = {
`${process.env.GITHUB_ACTION_PATH}/src/mcp/github-comment-server.ts`,
],
env: {
GITHUB_TOKEN: process.env.GITHUB_TOKEN || "",
GITHUB_TOKEN: githubToken || "",
REPO_OWNER: context.repository.owner,
REPO_NAME: context.repository.repo,
GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || "",