[PR #8956] [MERGED] ci: add auto-labeling for PRs with c-* domain labels #25224

Closed
opened 2026-04-15 22:46:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8956
Author: @gustavovalverde
Created: 4/4/2026
Status: Merged
Merged: 4/4/2026
Merged by: @gustavovalverde

Base: mainHead: ci/auto-label


📝 Commits (5)

  • 8542c97 ci: add auto-labeling for PRs with c-* domain labels
  • 41a1745 fix(ci): exclude c-docs and c-devops from cross-cutting detection
  • 8587943 refactor: move pr-analyzer to .github/scripts, remove backfill script
  • d10fb90 chore: fix misleading comment in pr-analyzer
  • 6e40919 fix: add .github/scripts to knip ignore list

📊 Changes

4 files changed (+403 additions, -1 deletions)

View changed files

.github/labeler.yml (+116 -0)
.github/scripts/pr-analyzer.ts (+245 -0)
.github/workflows/auto-label.yml (+39 -0)
📝 knip.jsonc (+3 -1)

📄 Description

Summary

Auto-applies c-* domain labels to PRs based on changed file paths using actions/labeler v6.

How it works

  1. actions/labeler matches changed files against .github/labeler.yml and applies all matching c-* labels
  2. A refinement step detects cross-cutting PRs (3+ domain labels) and replaces with just c-core

Files

File Purpose
.github/labeler.yml File-path → label mapping (13 domains)
.github/workflows/auto-label.yml Workflow: applies labels on PR open/synchronize
scripts/lib/pr-analyzer.ts Shared classification module (scope→domain, file→domain)
scripts/label-pr.ts Standalone CLI for labeling single PRs or batch backfill

Backfill existing PRs

npx tsx scripts/label-pr.ts --backfill --limit 50 --dry-run
npx tsx scripts/label-pr.ts --backfill --limit 50

Security

Uses pull_request_target to get write access for labeling fork PRs. Only reads PR metadata (title, file list via API). Never checks out or executes fork code.


Summary by cubic

Automatically labels PRs with c-* domain labels based on changed file paths using actions/labeler v6. Cross-cutting PRs (3+ primary domains; c-docs/c-devops excluded) are collapsed to c-core to reduce noise.

  • New Features

    • Added .github/labeler.yml mapping file paths to 13 c-* domain labels.
    • Added .github/workflows/auto-label.yml to label on PR open/sync and refine 3+ primary domain matches to c-core.
    • Security: runs on pull_request_target with read contents and write pull-requests; reads PR metadata only.
  • Refactors

    • Moved shared classifier to .github/scripts/pr-analyzer.ts and clarified a misleading comment.
    • Removed scripts/label-pr.ts backfill script from the repo.
    • Ignored .github/scripts/** in knip.jsonc to prevent false unused warnings.

Written for commit 6e40919604. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8956 **Author:** [@gustavovalverde](https://github.com/gustavovalverde) **Created:** 4/4/2026 **Status:** ✅ Merged **Merged:** 4/4/2026 **Merged by:** [@gustavovalverde](https://github.com/gustavovalverde) **Base:** `main` ← **Head:** `ci/auto-label` --- ### 📝 Commits (5) - [`8542c97`](https://github.com/better-auth/better-auth/commit/8542c97d6590d74a000a2b3f8e1e889570da8be5) ci: add auto-labeling for PRs with c-* domain labels - [`41a1745`](https://github.com/better-auth/better-auth/commit/41a1745eaf32629d912f66c400ba5e4368b5d1dd) fix(ci): exclude c-docs and c-devops from cross-cutting detection - [`8587943`](https://github.com/better-auth/better-auth/commit/8587943b981fce2396dc88c6b15d71b807d33a74) refactor: move pr-analyzer to .github/scripts, remove backfill script - [`d10fb90`](https://github.com/better-auth/better-auth/commit/d10fb90aef5bcf89be8bd4146e641f082136eca2) chore: fix misleading comment in pr-analyzer - [`6e40919`](https://github.com/better-auth/better-auth/commit/6e4091960491b7c01b9c3b436b1f1576804ca904) fix: add .github/scripts to knip ignore list ### 📊 Changes **4 files changed** (+403 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `.github/labeler.yml` (+116 -0) ➕ `.github/scripts/pr-analyzer.ts` (+245 -0) ➕ `.github/workflows/auto-label.yml` (+39 -0) 📝 `knip.jsonc` (+3 -1) </details> ### 📄 Description ## Summary Auto-applies `c-*` domain labels to PRs based on changed file paths using `actions/labeler` v6. ### How it works 1. `actions/labeler` matches changed files against `.github/labeler.yml` and applies all matching `c-*` labels 2. A refinement step detects cross-cutting PRs (3+ domain labels) and replaces with just `c-core` ### Files | File | Purpose | |---|---| | `.github/labeler.yml` | File-path → label mapping (13 domains) | | `.github/workflows/auto-label.yml` | Workflow: applies labels on PR open/synchronize | | `scripts/lib/pr-analyzer.ts` | Shared classification module (scope→domain, file→domain) | | `scripts/label-pr.ts` | Standalone CLI for labeling single PRs or batch backfill | ### Backfill existing PRs ```bash npx tsx scripts/label-pr.ts --backfill --limit 50 --dry-run npx tsx scripts/label-pr.ts --backfill --limit 50 ``` ### Security Uses `pull_request_target` to get write access for labeling fork PRs. Only reads PR metadata (title, file list via API). Never checks out or executes fork code. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Automatically labels PRs with `c-*` domain labels based on changed file paths using `actions/labeler` v6. Cross-cutting PRs (3+ primary domains; `c-docs`/`c-devops` excluded) are collapsed to `c-core` to reduce noise. - **New Features** - Added `.github/labeler.yml` mapping file paths to 13 `c-*` domain labels. - Added `.github/workflows/auto-label.yml` to label on PR open/sync and refine 3+ primary domain matches to `c-core`. - Security: runs on `pull_request_target` with read contents and write pull-requests; reads PR metadata only. - **Refactors** - Moved shared classifier to `.github/scripts/pr-analyzer.ts` and clarified a misleading comment. - Removed `scripts/label-pr.ts` backfill script from the repo. - Ignored `.github/scripts/**` in `knip.jsonc` to prevent false unused warnings. <sup>Written for commit 6e4091960491b7c01b9c3b436b1f1576804ca904. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:46:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25224