mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 06:54:13 +08:00
fix(github): fixing claude login user name (#227)
* fix(github): fixing claude login user name * fix: improving bot user identification conditions * fix: making a const out of claude bot id
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
|||||||
} from "../../context";
|
} from "../../context";
|
||||||
import type { Octokit } from "@octokit/rest";
|
import type { Octokit } from "@octokit/rest";
|
||||||
|
|
||||||
|
const CLAUDE_APP_BOT_ID = 209825114;
|
||||||
|
|
||||||
export async function createInitialComment(
|
export async function createInitialComment(
|
||||||
octokit: Octokit,
|
octokit: Octokit,
|
||||||
context: ParsedGitHubContext,
|
context: ParsedGitHubContext,
|
||||||
@@ -36,11 +38,15 @@ export async function createInitialComment(
|
|||||||
repo,
|
repo,
|
||||||
issue_number: context.entityNumber,
|
issue_number: context.entityNumber,
|
||||||
});
|
});
|
||||||
const existingComment = comments.data.find(
|
const existingComment = comments.data.find((comment) => {
|
||||||
(comment) =>
|
const idMatch = comment.user?.id === CLAUDE_APP_BOT_ID;
|
||||||
comment.user?.login.indexOf("claude[bot]") !== -1 ||
|
const botNameMatch =
|
||||||
comment.body === initialBody,
|
comment.user?.type === "Bot" &&
|
||||||
);
|
comment.user?.login.toLowerCase().includes("claude");
|
||||||
|
const bodyMatch = comment.body === initialBody;
|
||||||
|
|
||||||
|
return idMatch || botNameMatch || bodyMatch;
|
||||||
|
});
|
||||||
if (existingComment) {
|
if (existingComment) {
|
||||||
response = await octokit.rest.issues.updateComment({
|
response = await octokit.rest.issues.updateComment({
|
||||||
owner,
|
owner,
|
||||||
|
|||||||
Reference in New Issue
Block a user