From f6d7bbc902111f34b0ba3f6457843f66ecc6dbd1 Mon Sep 17 00:00:00 2001 From: yiqingxiong Date: Fri, 6 Feb 2026 17:13:26 +0800 Subject: [PATCH] fix typecheck error --- src/github/operations/branch-cleanup.ts | 1 - src/github/operations/branch.ts | 1 + src/github/operations/comment-logic.ts | 4 ++-- src/github/token.ts | 1 + src/mcp/install-mcp-server.ts | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/github/operations/branch-cleanup.ts b/src/github/operations/branch-cleanup.ts index fa6e659..33f6b19 100644 --- a/src/github/operations/branch-cleanup.ts +++ b/src/github/operations/branch-cleanup.ts @@ -1,5 +1,4 @@ import type { Octokits } from "../api/client"; -import { GITHUB_SERVER_URL, USE_GITEA_API } from "../api/config"; import { createBranchUrl } from "./comments/common"; import { $ } from "bun"; diff --git a/src/github/operations/branch.ts b/src/github/operations/branch.ts index aea1b9c..19d3733 100644 --- a/src/github/operations/branch.ts +++ b/src/github/operations/branch.ts @@ -305,5 +305,6 @@ export async function setupBranch( } catch (error) { console.error("Error in branch setup:", error); process.exit(1); + throw error; } } diff --git a/src/github/operations/comment-logic.ts b/src/github/operations/comment-logic.ts index 679e0a2..b52ba31 100644 --- a/src/github/operations/comment-logic.ts +++ b/src/github/operations/comment-logic.ts @@ -1,4 +1,4 @@ -import { GITHUB_SERVER_URL, USE_GITEA_API } from "../api/config"; +import { USE_GITEA_API } from "../api/config"; import { createBranchUrl } from "./comments/common"; export type ExecutionDetails = { @@ -162,7 +162,7 @@ export function updateCommentBody(input: CommentUpdateInput): string { const repoMatch = USE_GITEA_API ? jobUrl.match(/\/([^\/]+)\/([^\/]+)\/(?:actions|tree|src)/) : jobUrl.match(/github\.com\/([^\/]+)\/([^\/]+)\//); - if (repoMatch) { + if (repoMatch && repoMatch[1] && repoMatch[2]) { branchUrl = createBranchUrl( repoMatch[1], repoMatch[2], diff --git a/src/github/token.ts b/src/github/token.ts index 54948d1..9987e3a 100644 --- a/src/github/token.ts +++ b/src/github/token.ts @@ -151,5 +151,6 @@ export async function setupGitHubToken(): Promise { `Failed to setup GitHub token: ${error}\n\nIf you instead wish to use this action with a custom GitHub token or custom GitHub app, provide a \`github_token\` in the \`uses\` section of the app in your workflow yml file.`, ); process.exit(1); + throw error; } } diff --git a/src/mcp/install-mcp-server.ts b/src/mcp/install-mcp-server.ts index 22de611..458b696 100644 --- a/src/mcp/install-mcp-server.ts +++ b/src/mcp/install-mcp-server.ts @@ -224,5 +224,6 @@ export async function prepareMcpConfig( } catch (error) { core.setFailed(`Install MCP server failed with error: ${error}`); process.exit(1); + throw error; } }