Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

870 B
Raw Blame
const CLOSE_RE =
  /gh issue close\b|issues\.update\b|state=closed/g;

const KEYWORD_RE = new RegExp(
  String.raw`\b(?:fix(?:es|ed)?|close[sd]?|resolve[sd]?)\s+#(\d+)\b`,
  "i"
);

export function findTrackerCloses(workflowText) {
  const hits = [];
  const lines = String(workflowText ?? "").split(/\n/);
  for (let i = 0; i < lines.length; i++) {
    CLOSE_RE.lastIndex = 0;
    if (CLOSE_RE.test(lines[i])) {
      hits.push({ line: i + 1, text: lines[i].trim() });
    }
    CLOSE_RE.lastIndex = 0;
  }
  return hits;
}

export function closingKeywordInBody(body, tracker = 12732) {
  const re = new RegExp(KEYWORD_RE.source, KEYWORD_RE.flags.includes("g") ? KEYWORD_RE.flags : `${KEYWORD_RE.flags}g`);
  const text = String(body ?? "");
  let m;
  while ((m = re.exec(text)) !== null) {
    if (Number(m[1]) === Number(tracker)) return true;
  }
  return false;
}