diff --git a/src/entrypoints/update-comment-link.ts b/src/entrypoints/update-comment-link.ts index 0e7c87d..85b2455 100644 --- a/src/entrypoints/update-comment-link.ts +++ b/src/entrypoints/update-comment-link.ts @@ -24,13 +24,6 @@ async function run() { const context = parseGitHubContext(); const { owner, repo } = context.repository; - - // This script is only called for entity-based events - if (!context.entityNumber) { - throw new Error("update-comment-link requires an entityNumber"); - } - const entityNumber = context.entityNumber; - const octokit = createOctokit(githubToken); const serverUrl = GITHUB_SERVER_URL; @@ -80,7 +73,7 @@ async function run() { const { data: pr } = await octokit.rest.pulls.get({ owner, repo, - pull_number: entityNumber, + pull_number: context.entityNumber, }); console.log(`PR state: ${pr.state}`); console.log(`PR comments count: ${pr.comments}`); diff --git a/src/github/operations/comments/create-initial.ts b/src/github/operations/comments/create-initial.ts index 8de1fbc..1243035 100644 --- a/src/github/operations/comments/create-initial.ts +++ b/src/github/operations/comments/create-initial.ts @@ -22,12 +22,6 @@ export async function createInitialComment( ) { const { owner, repo } = context.repository; - // Entity events should always have entityNumber - if (!context.entityNumber) { - throw new Error("createInitialComment requires an entityNumber"); - } - const entityNumber = context.entityNumber; - const jobRunLink = createJobRunLink(owner, repo, context.runId); const initialBody = createCommentBody(jobRunLink); @@ -42,7 +36,7 @@ export async function createInitialComment( const comments = await octokit.rest.issues.listComments({ owner, repo, - issue_number: entityNumber, + issue_number: context.entityNumber, }); const existingComment = comments.data.find((comment) => { const idMatch = comment.user?.id === CLAUDE_APP_BOT_ID; @@ -65,7 +59,7 @@ export async function createInitialComment( response = await octokit.rest.issues.createComment({ owner, repo, - issue_number: entityNumber, + issue_number: context.entityNumber, body: initialBody, }); } @@ -74,7 +68,7 @@ export async function createInitialComment( response = await octokit.rest.pulls.createReplyForReviewComment({ owner, repo, - pull_number: entityNumber, + pull_number: context.entityNumber, comment_id: context.payload.comment.id, body: initialBody, }); @@ -83,7 +77,7 @@ export async function createInitialComment( response = await octokit.rest.issues.createComment({ owner, repo, - issue_number: entityNumber, + issue_number: context.entityNumber, body: initialBody, }); } @@ -101,7 +95,7 @@ export async function createInitialComment( const response = await octokit.rest.issues.createComment({ owner, repo, - issue_number: entityNumber, + issue_number: context.entityNumber, body: initialBody, }); diff --git a/src/github/operations/default-branch.ts b/src/github/operations/default-branch.ts deleted file mode 100644 index 51e3251..0000000 --- a/src/github/operations/default-branch.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Octokit } from "@octokit/rest"; - -export async function getDefaultBranch( - rest: Octokit, - owner: string, - repo: string, -): Promise { - const repoResponse = await rest.repos.get({ - owner, - repo, - }); - return repoResponse.data.default_branch; -} diff --git a/src/mcp/install-mcp-server.ts b/src/mcp/install-mcp-server.ts index 6f3f85c..c8cb125 100644 --- a/src/mcp/install-mcp-server.ts +++ b/src/mcp/install-mcp-server.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import { GITHUB_API_URL } from "../github/api/config"; +import { GITHUB_API_URL, GITHUB_SERVER_URL } from "../github/api/config"; import type { ParsedGitHubContext } from "../github/context"; import { Octokit } from "@octokit/rest"; @@ -141,7 +141,7 @@ export async function prepareMcpConfig( GITHUB_TOKEN: process.env.ACTIONS_TOKEN, REPO_OWNER: owner, REPO_NAME: repo, - PR_NUMBER: context.entityNumber?.toString() || "", + PR_NUMBER: context.entityNumber.toString(), RUNNER_TEMP: process.env.RUNNER_TEMP || "/tmp", }, }; @@ -156,10 +156,13 @@ export async function prepareMcpConfig( "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", - "ghcr.io/github/github-mcp-server:sha-721fd3e", // https://github.com/github/github-mcp-server/releases/tag/v0.6.0 + "ghcr.io/github/github-mcp-server:sha-efef8ae", // https://github.com/github/github-mcp-server/releases/tag/v0.9.0 + "-e", + "GITHUB_HOST", ], env: { GITHUB_PERSONAL_ACCESS_TOKEN: githubToken, + GITHUB_HOST: GITHUB_SERVER_URL, }, }; }