Skip to content

ci: auto-label pull requests by component and area - #2240

Merged
omri374 merged 4 commits into
mainfrom
claude/presidio-pr-issues-review-kdf3jq
Sep 8, 2026
Merged

ci: auto-label pull requests by component and area#2240
omri374 merged 4 commits into
mainfrom
claude/presidio-pr-issues-review-kdf3jq

Conversation

@omri374

@omri374 omri374 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Change Description

Adds actions/labeler so every pull request is labelled from its changed paths, instead of being triaged by hand.

Two new files:

  • .github/labeler.yml — path rules across three facets: component (which package), area (which analyzer subsystem), and type (samples, test, ci, dependencies).
  • .github/workflows/label-areas.yml — runs the labeler on opened, synchronize and reopened.

No behavior change to any Presidio package. This only affects repository automation.

Why this is worth doing

The immediate goal is a project board of open pull requests grouped by topic, so triage starts from "what is in each area" rather than a flat list of 50-plus pull requests. A board needs a reliable grouping key, and today there is none: the areas that actually generate the most work — YAML configuration and registry loading, context enhancement, NLP backends — have no label to group or filter on.

This change supplies that key. Once the labels are populated, the board can be built on top in either form:

  • Saved views filtered by label (is:open is:pr label:yaml-config), which needs no further setup.
  • A GitHub Project with a Topic single-select field mirroring the area labels, auto-populated by the built-in is:pr is:open add workflow.

Labelling every pull request by hand would not sustain either one, which is why this is automated rather than a one-off pass.

Why pull_request_target

Same reason label-external.yml already uses it: on a pull_request event from a fork, GitHub issues a read-only token and the label call fails silently. The usual pull_request_target risk does not apply here, because the action never checks out or executes pull request code — it reads the changed-file list through the API — and both the workflow and labeler.yml are read from the base branch, so a pull request cannot change the rules that label it.

sync-labels is left at false, so labels applied by hand are never stripped.

Labels

All 17 label names the config references now exist in the repository, so the labeler reuses them and creates nothing implicitly. Ten were already in use (analyzer, anonymizer, image-anonymization, dicom, structured-data, documentation, samples, deployment, dependencies, PII recognizers). Seven were added for this change:

Label Covers Open PRs today
context-enhancement context_aware_enhancers/** 4
yaml-config input_validation/**, recognizer_registry/**, conf/** 8
nlp-engine nlp_engine/**, chunkers/**, llm_utils/** 5
rest-api presidio-*/app.py, docs/api-docs/** 3
cli presidio-cli/** 0
test **/tests/**, e2e-tests/**
ci .github/workflows/**, .github/pipelines/**

context-enhancement and yaml-config are named to match the review rulebooks in .github/instructions/, so the label tells a reviewer which instruction file applies to the change.

Notes for review

  • Labels are not exclusive by design. A pull request spanning a package and a subsystem gets both: the component label answers what a release affects, the area label answers who should review it. A change under docs/samples/** gets both samples and documentation for the same reason — a sample is documentation, but it is also code that has to keep working.
  • analyzer will match nearly every analyzer pull request, including recognizer and YAML-config ones. That is intended — filtering happens on the area labels.
  • The labeler acts on events only, so it does not touch the currently open pull requests. Back-labelling those is a separate one-off pass, and is what makes the first board useful on day one rather than after the backlog turns over.
  • Label renames for casing consistency (PII recognizers, Performance, Advanced) are deliberately left out of this change, since renames happen in repository settings rather than in a diff.
  • actions/labeler is pinned to the commit SHA for v6.2.0, matching the convention in label-external.yml and the request in Pin GitHub Actions to full-length commit SHAs #2230.

Issue reference

No existing issue. Proposed while reviewing the open pull request and issue backlog, as the prerequisite for a topic-based board of open pull requests.

Checklist

  • I have reviewed the contribution guidelines
  • I agree to follow this project's Code of Conduct
  • I confirm that I have the right to submit this contribution and that it does not knowingly contain proprietary or confidential code.
  • My code includes unit tests — not applicable; the change is workflow configuration with no Python code. Both YAML files were validated as parsing.
  • All unit tests and lint checks pass locally — no Python source changed, so no test or lint surface is affected.
  • My PR contains documentation updates / additions if required — the rules are documented in comments inside labeler.yml.

🤖 Generated with Claude Code

https://claude.ai/code/session_0183ij1wiTEcd8wA58xY7e6C

Adds a path-based labeler so every pull request arrives routed to the
package it changes and the analyzer subsystem it touches, instead of
being triaged by hand.

Uses pull_request_target for the same reason label-external.yml does:
fork pull requests get a read-only token on pull_request, so the label
call would fail silently. The action never checks out or runs pull
request code, and both the workflow and the config are read from the
base branch, so a pull request cannot alter its own label rules.

sync-labels is left off so hand-applied triage labels are never removed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183ij1wiTEcd8wA58xY7e6C
Copilot AI lite review requested due to automatic review settings September 8, 2026 09:12
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-anonymizer)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-anonymizer/presidio_anonymizer
  __init__.py
  anonymizer_engine.py
  presidio-anonymizer/presidio_anonymizer/entities/engine
  pii_entity.py
  presidio-anonymizer/presidio_anonymizer/entities/engine/result
  operator_result.py
  presidio-anonymizer/presidio_anonymizer/operators
  custom.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-structured)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-structured/presidio_structured/data
  data_processors.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-cli)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-cli/presidio_cli
  cli.py
Project Total  

This report was generated by python-coverage-comment-action

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.

🟢 Approval recommended

The change is limited to GitHub automation configuration and appears consistent with existing repo workflow patterns (including pull_request_target usage and action pinning).

Pull request overview

Adds automated path-based labeling for pull requests, improving triage by applying component/area/type labels based on which parts of the repository a PR changes.

Changes:

  • Add a pull_request_target workflow to apply labels using actions/labeler on PR open/sync/reopen events.
  • Define label-to-path mapping rules for components, analyzer subsystems (areas), and change types (test/ci/dependencies).
File summaries
File Description
.github/workflows/label-areas.yml New workflow which runs actions/labeler to apply labels on relevant PR events.
.github/labeler.yml New labeler configuration mapping changed paths to component/area/type labels.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/labeler.yml Outdated
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-image-redactor)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-image-redactor/presidio_image_redactor
  dicom_image_pii_verify_engine.py
  document_intelligence_ocr.py
  image_analyzer_engine.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage report (presidio-analyzer)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-analyzer/presidio_analyzer
  analyzer_engine.py
  entity_recognizer.py
  presidio-analyzer/presidio_analyzer/chunkers
  character_based_text_chunker.py
  text_chunker_provider.py
  presidio-analyzer/presidio_analyzer/context_aware_enhancers
  lemma_context_aware_enhancer.py
  presidio-analyzer/presidio_analyzer/input_validation
  schemas.py
  yaml_recognizer_models.py
  presidio-analyzer/presidio_analyzer/llm_utils
  config_loader.py
  presidio-analyzer/presidio_analyzer/nlp_engine
  __init__.py
  nlp_engine_provider.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers
  __init__.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/finland
  fi_personal_identity_code_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/germany
  de_bsnr_recognizer.py
  de_id_card_recognizer.py
  de_lanr_recognizer.py
  de_passport_recognizer.py
  de_social_security_recognizer.py
  de_vat_id_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/poland
  pl_pesel_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/ner
  gliner_recognizer.py
  huggingface_ner_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/third_party
  azure_ai_language.py
  presidio-analyzer/presidio_analyzer/recognizer_registry
  recognizer_registry.py
  recognizer_registry_provider.py
  recognizers_loader_utils.py
Project Total  

The report is truncated to 25 files out of 81. To see the full report, please visit the workflow summary page.

This report was generated by python-coverage-comment-action

Samples are documentation but also code that has to keep working, so they
need to be findable on their own rather than only under documentation.
Reuses the existing `samples` label.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183ij1wiTEcd8wA58xY7e6C
Copilot AI review requested due to automatic review settings September 8, 2026 09:25
The header described two facets while the file defines three, and
`samples` sat under the component heading rather than type.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183ij1wiTEcd8wA58xY7e6C

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.

🟢 Approval recommended

Only minor documentation/comment clarity issues were found; the workflow and label rules appear correct and consistent with existing repo patterns.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

.github/labeler.yml:6

  • The header comment says only "Two facets" (component/area), but this file also defines a third facet (type) below. Updating the comment will prevent confusion for future maintainers.
    .github/labeler.yml:13
  • This note implies sync-labels will remove hand-applied triage labels, but this workflow currently sets sync-labels: false. Consider wording this as a conditional to avoid suggesting labels will be removed in the current setup.
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 8, 2026 09:29

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.

🟡 Changes recommended

The new label rules include at least one path glob that will mislabel unrelated changes (e.g., the deployment label matching the /presidio meta-package directory), reducing labeling accuracy.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

.github/labeler.yml:66

  • deployment currently matches presidio/**, but /presidio is a Python meta-package (not deployment configuration). This will mislabel meta-package PRs as deployment; consider removing this glob (Dockerfiles and compose files are already covered by the other patterns).
    .github/workflows/label-areas.yml:1
  • The workflow name says it labels PRs "by area", but this workflow applies all labels from .github/labeler.yml (component + area + type). Renaming the workflow makes the Actions UI clearer and avoids confusion for maintainers.
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread .github/workflows/label-areas.yml Outdated
The workflow and step names described component and area only, while the
config also applies type labels.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183ij1wiTEcd8wA58xY7e6C
Copilot AI review requested due to automatic review settings September 8, 2026 12:17

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.

🔵 Needs a closer look

The labeler config misses some intended documentation paths (e.g., structured docs and nested markdown), so certain PRs won’t be labeled as expected.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

.github/labeler.yml:47

  • structured-data component label only matches presidio-structured/**, but there are structured-data docs under docs/structured/** and structured-specific markdown under docs/**/*structured*.md (e.g., docs/structured/index.md, docs/api/structured_python.md). As-is, PRs that only update structured docs won’t get the structured-data label.
    .github/labeler.yml:74
  • The documentation label currently includes *.md, which only matches markdown files in the repo root and won’t match nested docs like presidio-analyzer/README.md or .github/PULL_REQUEST_TEMPLATE.md. If the intent is to label documentation changes across the repo, this glob should be recursive.
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@RonShakutai RonShakutai 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.

LGTM left 1 tiny comment.

Comment thread .github/labeler.yml
@omri374
omri374 merged commit a7b17c7 into main Sep 8, 2026
39 checks passed
@omri374
omri374 deleted the claude/presidio-pr-issues-review-kdf3jq branch September 8, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants