From 70ab76a05368a2c3a897b02dd0ae2c0aea7db02e Mon Sep 17 00:00:00 2001 From: Kartik Date: Tue, 21 Jul 2026 18:47:39 +0530 Subject: [PATCH] ci: fix silently-broken issue labeling and add PR labeling (#6470) --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/feature_request.yml | 4 +- .github/advanced-issue-labeler.yml | 29 +++++------ .github/labeler.yml | 39 +++++++++++++++ .github/workflows/issue-labeler.yml | 17 +------ .github/workflows/pr-labeler.yml | 57 ++++++++++++++++++++++ AGENTS.md | 1 + 7 files changed, 118 insertions(+), 33 deletions(-) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/pr-labeler.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index c0cce7efc..c2f2a98b5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -9,9 +9,9 @@ body: label: Component description: Which part of mem0 is affected? options: - - Core / Python SDK + - Python SDK - TypeScript SDK - - Vector Store (Qdrant, PGVector, Redis, Chroma, etc.) + - Vector Store - OpenClaw - REST API - Other diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index d421810c1..29277100b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -9,9 +9,9 @@ body: label: Component description: Which part of mem0 does this relate to? options: - - Core / Python SDK + - Python SDK - TypeScript SDK - - Vector Store (Qdrant, PGVector, Redis, Chroma, etc.) + - Vector Store - OpenClaw - REST API - Other diff --git a/.github/advanced-issue-labeler.yml b/.github/advanced-issue-labeler.yml index 07f3f6aab..f9c47d023 100644 --- a/.github/advanced-issue-labeler.yml +++ b/.github/advanced-issue-labeler.yml @@ -1,14 +1,15 @@ -# Maps dropdown selections to GitHub labels -# Used by the advanced-issue-labeler GitHub Action - -component: - - label: "sdk-python" - matcher: "Core / Python SDK" - - label: "sdk-typescript" - matcher: "TypeScript SDK" - - label: "vector-store" - matcher: "Vector Store" - - label: "openclaw" - matcher: "OpenClaw" - - label: "rest-api" - matcher: "REST API" +policy: + - section: + - id: ['component'] + block-list: ['Other'] + label: + - name: 'sdk-python' + keys: ['Python SDK'] + - name: 'sdk-typescript' + keys: ['TypeScript SDK'] + - name: 'vector-store' + keys: ['Vector Store'] + - name: 'openclaw' + keys: ['OpenClaw'] + - name: 'rest-api' + keys: ['REST API'] diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..e07b9f78a --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,39 @@ +vector-store: + - changed-files: + - any-glob-to-any-file: 'mem0/vector_stores/**' + +sdk-python: + - changed-files: + - any-glob-to-any-file: ['mem0/**', 'tests/**'] + +sdk-typescript: + - changed-files: + - any-glob-to-any-file: 'mem0-ts/**' + +rest-api: + - changed-files: + - any-glob-to-any-file: 'server/**' + +openmemory: + - changed-files: + - any-glob-to-any-file: 'openmemory/**' + +openclaw: + - changed-files: + - any-glob-to-any-file: 'integrations/openclaw/**' + +integrations: + - changed-files: + - any-glob-to-any-file: 'integrations/**' + +cli: + - changed-files: + - any-glob-to-any-file: 'cli/**' + +documentation: + - changed-files: + - any-glob-to-any-file: 'docs/**' + +ci: + - changed-files: + - any-glob-to-any-file: '.github/**' diff --git a/.github/workflows/issue-labeler.yml b/.github/workflows/issue-labeler.yml index 0486a57b1..fc6dd70d5 100644 --- a/.github/workflows/issue-labeler.yml +++ b/.github/workflows/issue-labeler.yml @@ -12,6 +12,8 @@ jobs: label: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - uses: stefanbuck/github-issue-parser@v3 id: issue-parser with: @@ -20,20 +22,5 @@ jobs: - uses: redhat-plumbers-in-action/advanced-issue-labeler@v3 with: issue-form: ${{ steps.issue-parser.outputs.jsonString }} - section: component - token: ${{ secrets.GITHUB_TOKEN }} - config-path: .github/advanced-issue-labeler.yml - - - uses: stefanbuck/github-issue-parser@v3 - id: feature-parser - if: contains(github.event.issue.labels.*.name, 'enhancement') - with: - template-path: .github/ISSUE_TEMPLATE/feature_request.yml - - - uses: redhat-plumbers-in-action/advanced-issue-labeler@v3 - if: contains(github.event.issue.labels.*.name, 'enhancement') - with: - issue-form: ${{ steps.feature-parser.outputs.jsonString }} - section: component token: ${{ secrets.GITHUB_TOKEN }} config-path: .github/advanced-issue-labeler.yml diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 000000000..3635abe49 --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,57 @@ +name: PR Labeler + +on: + pull_request_target: + types: [opened, synchronize, reopened, edited] + +permissions: + contents: read + pull-requests: write + issues: read + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Propagate labels from linked issues + uses: actions/github-script@v7 + with: + script: | + const allowed = new Set([ + 'sdk-python', 'sdk-typescript', 'vector-store', 'openclaw', + 'rest-api', 'openmemory', 'documentation', 'ci', 'cli', 'integrations', + ]); + const body = context.payload.pull_request.body || ''; + const matches = [...body.matchAll(/\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s*(?:#|https:\/\/github\.com\/mem0ai\/mem0\/issues\/)(\d+)/gi)]; + const numbers = [...new Set(matches.map((m) => Number(m[1])))]; + + const labels = new Set(); + for (const issue_number of numbers) { + let issue; + try { + ({ data: issue } = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number, + })); + } catch { + continue; + } + if (issue.pull_request) continue; + for (const label of issue.labels) { + if (allowed.has(label.name)) labels.add(label.name); + } + } + + if (labels.size > 0) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: [...labels], + }); + } diff --git a/AGENTS.md b/AGENTS.md index b10ac7b90..993c51370 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -462,6 +462,7 @@ Publishing is routed through a single entry point: **`release.yml` (Release Rout | Workflow | File | Purpose | |----------|------|---------| | Issue Labeler | `issue-labeler.yml` | Automatic issue labeling | +| PR Labeler | `pr-labeler.yml` | Path-based PR labeling plus propagating labels from linked issues | | Stale Bot | `stale.yml` | Marks stale issues and PRs | | llms.txt Check | `docs-llms-txt-check.yml` | Blocks PRs touching `docs/**/*.mdx` when `docs/llms.txt` is out of sync. Fix locally with `python scripts/check-llms-txt-coverage.py --write`. |