Skip to content

[Repo] Cap package labels and infer type labels - #3574

Merged
adamziel merged 1 commit into
trunkfrom
adamziel/auto-labeler
May 4, 2026
Merged

[Repo] Cap package labels and infer type labels#3574
adamziel merged 1 commit into
trunkfrom
adamziel/auto-labeler

Conversation

@adamziel

Copy link
Copy Markdown
Collaborator

What it does

Caps auto-applied [Package][...] labels to the top 3 packages by changed
lines, and keeps actions/labeler focused on path labels that do not need a
cap: [Aspect], [Focus], [Feature], and [Type] Documentation.

The workflow also infers one [Type] label from an unambiguous
conventional-commit PR title prefix such as fix:, feat:, perf:, or
docs:.

Rationale

The old path-only package rules applied every matching package label. Wide
refactors could produce a wall of [Package] labels, which made the labels less
useful for scanning and triage.

[Type] labels are not reliably inferable from paths, but the PR title prefix
is a useful signal when it maps cleanly to one existing label.

Implementation

Removed [Package][...] rules from .github/labeler.yml and added a
package-and-type job to .github/workflows/auto-label-prs.yml.

The new job uses actions/github-script to:

  1. Fetch changed PR files.
  2. Match files to package labels by path prefix.
  3. Rank packages by additions + deletions, then file count.
  4. Apply at most 3 package labels.
  5. Apply one [Type] label when the PR title prefix is unambiguous.

Testing instructions

Validated locally with:

ruby -e "require 'yaml'; ARGV.each { |f| YAML.load_file(f); puts \"#{f}: YAML ok\" }" .github/labeler.yml .github/workflows/auto-label-prs.yml
npm exec prettier -- --check .github/labeler.yml .github/workflows/auto-label-prs.yml

Note: the commit hook attempted nx format --fix --parallel --uncommitted, but
this checkout does not have Nx modules installed, so that hook check could not
run locally.

@adamziel
adamziel marked this pull request as ready for review May 4, 2026 12:47
@adamziel
adamziel requested review from a team, JanJakes and Copilot May 4, 2026 12:47
@adamziel adamziel changed the title Auto-label PRs: cap package labels and infer type labels May 4, 2026
@adamziel
adamziel merged commit 06383e0 into trunk May 4, 2026
49 of 50 checks passed
@adamziel
adamziel deleted the adamziel/auto-labeler branch May 4, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the PR auto-labeling workflow to cap [Package][...] labels to the top 3 packages by churn and to infer a single [Type] label from conventional-commit PR title prefixes, while keeping actions/labeler focused on uncapped path-based labels.

Changes:

  • Split labeling into two jobs: path-based labeling via actions/labeler, and custom package/type labeling via actions/github-script.
  • Removed [Package][...] rules from .github/labeler.yml and documented the new responsibilities.
  • Added package ranking (by additions+deletions, then file count) and [Type] inference rules based on PR title prefix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/auto-label-prs.yml Adds a custom job to cap package labels and infer a [Type] label; renames the existing labeler job to paths.
.github/labeler.yml Removes package label rules and narrows labeler.yml’s scope to uncapped, path-inferable labels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -25,7 +35,7 @@ permissions:
pull-requests: write
Comment on lines +94 to +98
const TYPE_RULES = [
[/^fix(\(|:)/i, '[Type] Bug'],
[/^feat(ure)?(\(|:)/i, '[Type] Enhancement'],
[/^perf(\(|:)/i, '[Type] Performance'],
[/^docs(\(|:)/i, '[Type] Documentation'],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants