🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(ci): harden cursor PR labeling (#17167)
Nikita Kabardine69f03c7bb48
diff --git a/.github/workflows/label-cursor-prs.yml b/.github/workflows/label-cursor-prs.ymlindex 0adc59c9c1..fd18c4e44a 100644--- a/.github/workflows/label-cursor-prs.yml+++ b/.github/workflows/label-cursor-prs.yml@@ -29,8 +29,8 @@ jobs:const pr = context.payload.pull_request;const { owner, repo } = context.repo;- if (pr.head.repo.full_name !== `${owner}/${repo}`) {- core.info("Fork PR; Cursor auto-label is limited to same-repo branches.");+ if (pr.head.repo?.full_name !== `${owner}/${repo}`) {+ core.info("Fork or deleted-head PR; Cursor auto-label is limited to same-repo branches.");return;}@@ -46,7 +46,7 @@ jobs:const isCursorPr =author === "cursor[bot]" ||headRef.startsWith("cursor/") ||- body.includes("CURSOR_AGENT_PR_BODY_BEGIN");+ body.includes("<!-- CURSOR_AGENT_PR_BODY_BEGIN -->");if (!isCursorPr) {core.info(diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.ymlindex e2872a2021..16a331edf1 100644--- a/.github/workflows/pipeline.yml+++ b/.github/workflows/pipeline.yml@@ -175,6 +175,8 @@ jobs:# by every AGENTS.md are resolved.- name: agent guidance paths resolverun: pnpm run agents:check+ - name: cursor PR label tests+ run: node --test scripts/github/label-cursor-prs.test.mjs- name: Load default envrun: |cp .env.dev.example .envdiff --git a/scripts/github/is-cursor-pr.mjs b/scripts/github/is-cursor-pr.mjsindex 4c7278ca0f..5ed2c6f8bb 100644--- a/scripts/github/is-cursor-pr.mjs+++ b/scripts/github/is-cursor-pr.mjs@@ -6,6 +6,6 @@ export function isCursorPr({ author = "", headRef = "", body = "" } = {}) {return (author === "cursor[bot]" ||headRef.startsWith("cursor/") ||- body.includes("CURSOR_AGENT_PR_BODY_BEGIN")+ body.includes("<!-- CURSOR_AGENT_PR_BODY_BEGIN -->"));}diff --git a/scripts/github/label-cursor-prs.test.mjs b/scripts/github/label-cursor-prs.test.mjsindex 44a02de435..dc215f9d38 100644--- a/scripts/github/label-cursor-prs.test.mjs+++ b/scripts/github/label-cursor-prs.test.mjs@@ -47,6 +47,17 @@ test("ordinary maintainer PRs are not labeled", () => {);});+test("a prose mention of the marker name is not enough", () => {+ assert.equal(+ isCursorPr({+ author: "maxdeichmann",+ headRef: "lfe-15605-discuss-marker",+ body: "Detect Cursor PRs via CURSOR_AGENT_PR_BODY_BEGIN in the workflow.",+ }),+ false,+ );+});+test("workflow stays on pull_request and does not check out PR code", () => {assert.match(workflow, /^on:\n pull_request:/m);assert.doesNotMatch(workflow, /^on:\n pull_request_target:/m);@@ -60,7 +71,11 @@ test("workflow stays on pull_request and does not check out PR code", () => {test("workflow uses the same three Cursor signals as isCursorPr", () => {assert.match(workflow, /author === "cursor\[bot]"/);assert.match(workflow, /headRef\.startsWith\("cursor\/"\)/);- assert.match(workflow, /body\.includes\("CURSOR_AGENT_PR_BODY_BEGIN"\)/);+ assert.match(+ workflow,+ /body\.includes\("<!-- CURSOR_AGENT_PR_BODY_BEGIN -->"\)/,+ );+ assert.match(workflow, /pr\.head\.repo\?\.full_name/);});test("workflow treats a concurrent createLabel 422 as success", () => {