fix: simplify matching to header-only, drop bot ID check
Legacy comments without headers will naturally age out. No need for bot ID fallback logic that was broken anyway (wrong default ID). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3128a645ab
commit
cc19ae6bba
@ -50,41 +50,13 @@ export async function createInitialComment(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const existingComment = comments.find((comment) => {
|
const existingComment = comments.find((comment) => {
|
||||||
if (botIdentifier) {
|
if (!botIdentifier) return false;
|
||||||
// Check for our hidden header (case-insensitive, whitespace-tolerant)
|
|
||||||
const headerPattern = new RegExp(
|
const headerPattern = new RegExp(
|
||||||
`<!--\\s*bot:\\s*${escapeRegex(botIdentifier)}\\s*-->`,
|
`<!--\\s*bot:\\s*${escapeRegex(botIdentifier)}\\s*-->`,
|
||||||
"i",
|
"i",
|
||||||
);
|
);
|
||||||
const hasOurHeader = headerPattern.test(comment.body || "");
|
return headerPattern.test(comment.body || "");
|
||||||
|
|
||||||
// Check if comment has ANY bot header
|
|
||||||
const hasAnyHeader = /<!--\s*bot:\s*\S+\s*-->/.test(
|
|
||||||
comment.body || "",
|
|
||||||
);
|
|
||||||
|
|
||||||
// Header match is authoritative — no bot ID check needed
|
|
||||||
if (hasAnyHeader) {
|
|
||||||
return hasOurHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy comments (no header): require bot ID + Claude content
|
|
||||||
const idMatch = comment.user?.id === Number(context.inputs.botId);
|
|
||||||
if (!idMatch) return false;
|
|
||||||
|
|
||||||
const isClaudeComment =
|
|
||||||
comment.body?.includes("Claude Code is working") ||
|
|
||||||
comment.body?.includes("View job run");
|
|
||||||
|
|
||||||
return isClaudeComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback when no botIdentifier: match by bot user
|
|
||||||
const idMatch = comment.user?.id === Number(context.inputs.botId);
|
|
||||||
const botNameMatch =
|
|
||||||
comment.user?.type === "Bot" &&
|
|
||||||
comment.user?.login.toLowerCase().includes("claude");
|
|
||||||
return idMatch || botNameMatch;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existingComment) {
|
if (existingComment) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user