mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 06:54:13 +08:00
* feat: add use_commit_signing input with default false - Add new input 'use_commit_signing' to action.yml (defaults to false) - Separate comment update functionality into standalone github-comment-server.ts - Update MCP server configuration to conditionally load servers based on signing preference - When commit signing is disabled, use specific Bash git commands (e.g., Bash(git add:*)) - When commit signing is enabled, use github-file-ops-server for atomic commits with signing - Always include github-comment-server for comment updates regardless of signing mode - Update prompt generation to provide appropriate instructions based on signing preference - Add comprehensive test coverage for new functionality This change simplifies the default setup for users who don't need commit signing, while maintaining the option to enable it for those who require GitHub's commit signature verification. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: auto-commit uncommitted changes when commit signing is disabled - Check for uncommitted changes after Claude finishes (non-signing mode only) - Automatically commit and push any uncommitted work to preserve Claude's changes - Update tests to avoid actual git operations during test runs - Pass use_commit_signing flag to branch cleanup logic --------- Co-authored-by: Claude <noreply@anthropic.com>
99 lines
2.6 KiB
JavaScript
99 lines
2.6 KiB
JavaScript
#!/usr/bin/env node
|
|
// GitHub Comment MCP Server - Minimal server that only provides comment update functionality
|
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
import { z } from "zod";
|
|
import { GITHUB_API_URL } from "../github/api/config";
|
|
import { Octokit } from "@octokit/rest";
|
|
import { updateClaudeComment } from "../github/operations/comments/update-claude-comment";
|
|
|
|
// Get repository information from environment variables
|
|
const REPO_OWNER = process.env.REPO_OWNER;
|
|
const REPO_NAME = process.env.REPO_NAME;
|
|
|
|
if (!REPO_OWNER || !REPO_NAME) {
|
|
console.error(
|
|
"Error: REPO_OWNER and REPO_NAME environment variables are required",
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
const server = new McpServer({
|
|
name: "GitHub Comment Server",
|
|
version: "0.0.1",
|
|
});
|
|
|
|
server.tool(
|
|
"update_claude_comment",
|
|
"Update the Claude comment with progress and results (automatically handles both issue and PR comments)",
|
|
{
|
|
body: z.string().describe("The updated comment content"),
|
|
},
|
|
async ({ body }) => {
|
|
try {
|
|
const githubToken = process.env.GITHUB_TOKEN;
|
|
const claudeCommentId = process.env.CLAUDE_COMMENT_ID;
|
|
const eventName = process.env.GITHUB_EVENT_NAME;
|
|
|
|
if (!githubToken) {
|
|
throw new Error("GITHUB_TOKEN environment variable is required");
|
|
}
|
|
if (!claudeCommentId) {
|
|
throw new Error("CLAUDE_COMMENT_ID environment variable is required");
|
|
}
|
|
|
|
const owner = REPO_OWNER;
|
|
const repo = REPO_NAME;
|
|
const commentId = parseInt(claudeCommentId, 10);
|
|
|
|
const octokit = new Octokit({
|
|
auth: githubToken,
|
|
baseUrl: GITHUB_API_URL,
|
|
});
|
|
|
|
const isPullRequestReviewComment =
|
|
eventName === "pull_request_review_comment";
|
|
|
|
const result = await updateClaudeComment(octokit, {
|
|
owner,
|
|
repo,
|
|
commentId,
|
|
body,
|
|
isPullRequestReviewComment,
|
|
});
|
|
|
|
return {
|
|
content: [
|
|
{
|
|
type: "text",
|
|
text: JSON.stringify(result, null, 2),
|
|
},
|
|
],
|
|
};
|
|
} catch (error) {
|
|
const errorMessage =
|
|
error instanceof Error ? error.message : String(error);
|
|
return {
|
|
content: [
|
|
{
|
|
type: "text",
|
|
text: `Error: ${errorMessage}`,
|
|
},
|
|
],
|
|
error: errorMessage,
|
|
isError: true,
|
|
};
|
|
}
|
|
},
|
|
);
|
|
|
|
async function runServer() {
|
|
const transport = new StdioServerTransport();
|
|
await server.connect(transport);
|
|
process.on("exit", () => {
|
|
server.close();
|
|
});
|
|
}
|
|
|
|
runServer().catch(console.error);
|