mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-02-20 10:32:49 +08:00
Attempt to make this work
This commit is contained in:
@@ -584,16 +584,7 @@ Important Notes:
|
||||
- Never create new comments. Only update the existing comment using ${eventData.eventName === "pull_request_review_comment" ? "mcp__github__update_pull_request_comment" : "mcp__github__update_issue_comment"} with comment_id: ${context.claudeCommentId}.
|
||||
- This includes ALL responses: code reviews, answers to questions, progress updates, and final results.${eventData.isPR ? "\n- PR CRITICAL: After reading files and forming your response, you MUST post it by calling mcp__github__update_issue_comment. Do NOT just respond with a normal response, the user will not see it." : ""}
|
||||
- You communicate exclusively by editing your single comment - not through any other means.
|
||||
- Use this spinner HTML when work is in progress: ${(() => {
|
||||
try {
|
||||
const spinnerPath = require("path").join(__dirname, "../assets/spinner.gif");
|
||||
const spinnerBuffer = require("fs").readFileSync(spinnerPath);
|
||||
const base64Data = spinnerBuffer.toString("base64");
|
||||
return `<img src="data:image/gif;base64,${base64Data}" width="14px" height="14px" style="vertical-align: middle; margin-left: 4px;" />`;
|
||||
} catch (error) {
|
||||
return '<span style="margin-left: 4px;">⏳</span>';
|
||||
}
|
||||
})()}
|
||||
- Use this spinner HTML when work is in progress: <img src="https://raw.githubusercontent.com/markwylde/claude-code-gitea-action/refs/heads/gitea/assets/spinner.gif" width="14px" height="14px" style="vertical-align: middle; margin-left: 4px;" />
|
||||
${eventData.isPR && !eventData.claudeBranch ? `- Always push to the existing branch when triggered on a PR.` : `- IMPORTANT: You are already on the correct branch (${eventData.claudeBranch || "the created branch"}). Never create new branches when triggered on issues or closed/merged PRs.`}
|
||||
- Use mcp__local_git_ops__commit_files for making commits (works for both new and existing files, single or multiple). Use mcp__local_git_ops__delete_files for deleting files (supports deleting single or multiple files atomically), or mcp__github__delete_file for deleting a single file. Edit files locally, and the tool will read the content from the same path on disk.
|
||||
Tool usage examples:
|
||||
|
||||
@@ -46,7 +46,7 @@ export async function checkAndDeleteEmptyBranch(
|
||||
console.log(
|
||||
`Branch ${claudeBranch} appears to have commits (different SHA from base)`,
|
||||
);
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/src/branch/${claudeBranch}`;
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
} else {
|
||||
console.log(
|
||||
@@ -63,7 +63,7 @@ export async function checkAndDeleteEmptyBranch(
|
||||
console.log(
|
||||
`Branch ${claudeBranch} exists but SHA comparison failed, assuming it has commits`,
|
||||
);
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/src/branch/${claudeBranch}`;
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
} else {
|
||||
console.log(
|
||||
@@ -76,7 +76,7 @@ export async function checkAndDeleteEmptyBranch(
|
||||
console.error("Error checking branch with git commands:", error);
|
||||
// For errors, assume the branch has commits to be safe
|
||||
console.log("Assuming branch exists due to git command error");
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/src/branch/${claudeBranch}`;
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
}
|
||||
} else {
|
||||
@@ -106,7 +106,7 @@ export async function checkAndDeleteEmptyBranch(
|
||||
console.log(
|
||||
`Branch ${claudeBranch} appears to have commits (different SHA from base)`,
|
||||
);
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/src/branch/${claudeBranch}`;
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
} else {
|
||||
console.log(
|
||||
@@ -127,7 +127,7 @@ export async function checkAndDeleteEmptyBranch(
|
||||
} else {
|
||||
// For other errors, assume the branch has commits to be safe
|
||||
console.log("Assuming branch exists due to non-404 error");
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/tree/${claudeBranch}`;
|
||||
const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/src/branch/${claudeBranch}`;
|
||||
branchLink = `\n[View branch](${branchUrl})`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ export function updateCommentBody(input: CommentUpdateInput): string {
|
||||
// Extract owner/repo from jobUrl
|
||||
const repoMatch = jobUrl.match(/github\.com\/([^\/]+)\/([^\/]+)\//);
|
||||
if (repoMatch) {
|
||||
branchUrl = `${GITEA_SERVER_URL}/${repoMatch[1]}/${repoMatch[2]}/tree/${finalBranchName}`;
|
||||
branchUrl = `${GITEA_SERVER_URL}/${repoMatch[1]}/${repoMatch[2]}/src/branch/${finalBranchName}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,7 @@ import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
function getSpinnerHtml(): string {
|
||||
try {
|
||||
const spinnerPath = join(__dirname, "../../../assets/spinner.gif");
|
||||
const spinnerBuffer = readFileSync(spinnerPath);
|
||||
const base64Data = spinnerBuffer.toString("base64");
|
||||
return `<img src="data:image/gif;base64,${base64Data}" width="14px" height="14px" style="vertical-align: middle; margin-left: 4px;" />`;
|
||||
} catch (error) {
|
||||
console.warn("Could not load spinner image, using fallback");
|
||||
// Fallback to a simple text spinner
|
||||
return '<span style="margin-left: 4px;">⏳</span>';
|
||||
}
|
||||
return `<img src="https://raw.githubusercontent.com/markwylde/claude-code-gitea-action/refs/heads/gitea/assets/spinner.gif" width="14px" height="14px" style="vertical-align: middle; margin-left: 4px;" />`;
|
||||
}
|
||||
|
||||
export const SPINNER_HTML = getSpinnerHtml();
|
||||
|
||||
Reference in New Issue
Block a user