2026-01-29 23:07:16 +08:00

47 lines
1.2 KiB
TypeScript

import { GITHUB_SERVER_URL, USE_GITEA_API } from "../../api/config";
export const SPINNER_HTML =
'<img src="https://github.com/user-attachments/assets/5ac382c7-e004-429b-8e35-7feb3e8f9c6f" width="14px" height="14px" style="vertical-align: middle; margin-left: 4px;" />';
export function createJobRunLink(
owner: string,
repo: string,
runId: string,
): string {
const jobRunUrl = `${GITHUB_SERVER_URL}/${owner}/${repo}/actions/runs/${runId}`;
return `[View job run](${jobRunUrl})`;
}
export function createBranchLink(
owner: string,
repo: string,
branchName: string,
): string {
const branchUrl = createBranchUrl(owner, repo, branchName);
return `\n[View branch](${branchUrl})`;
}
/**
* Create a branch URL for the current platform
*/
export function createBranchUrl(
owner: string,
repo: string,
branchName: string,
): string {
return USE_GITEA_API
? `${GITHUB_SERVER_URL}/${owner}/${repo}/src/branch/${branchName}`
: `${GITHUB_SERVER_URL}/${owner}/${repo}/tree/${branchName}`;
}
export function createCommentBody(
jobRunLink: string,
branchLink: string = "",
): string {
return `Claude Code is working… ${SPINNER_HTML}
I'll analyze this and get back to you.
${jobRunLink}${branchLink}`;
}