Skip to content

auto label feature#218

Merged
sapnilbiswas merged 2 commits intoStanzin7:masterfrom
sapnilbiswas:codex/auto-label-feature
Apr 8, 2026
Merged

auto label feature#218
sapnilbiswas merged 2 commits intoStanzin7:masterfrom
sapnilbiswas:codex/auto-label-feature

Conversation

@sapnilbiswas
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 8, 2026 21:54
@github-actions github-actions Bot added the area: infra CI, deployment, database, or repository automation changes label Apr 8, 2026
@sapnilbiswas sapnilbiswas force-pushed the codex/auto-label-feature branch from 77bb3c8 to b1476e1 Compare April 8, 2026 21:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds repository automation to standardize labels and automatically apply them to PRs (by changed paths) and Issues (by keyword matching), with optional backfill for existing open items.

Changes:

  • Introduces an Auto Label GitHub Actions workflow that ensures a baseline label set exists, then applies labels to PRs/issues and supports manual backfill via workflow_dispatch.
  • Adds .github/labeler.yml path-to-label rules to drive PR labeling.

Reviewed changes

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

File Description
.github/workflows/auto-label.yml Creates/updates repo labels, labels PRs via actions/labeler, labels issues via keyword rules, and provides backfill jobs for open PRs/issues.
.github/labeler.yml Defines file-path glob rules mapping changes to area:* labels for PR auto-labeling.
Comments suppressed due to low confidence (2)

.github/workflows/auto-label.yml:24

  • Workflow-level permissions grant pull-requests: write for all triggers (including issues and workflow_dispatch). For least-privilege, consider moving permissions to per-job blocks (e.g., ensure-labels/issue-keyword-labels only need issues: write, while pr-path-labels needs issues: write + minimal PR/content read as required).
permissions:
  contents: read
  issues: write
  pull-requests: write

.github/workflows/auto-label.yml:156

  • With sync-labels: true, the labeler will remove config-managed labels when patterns stop matching (e.g., after a PR update), which also removes any manual overrides for those same labels on subsequent synchronize events. If you want to allow maintainers to manually keep an area: label even when patterns no longer match, consider setting sync-labels: false or limiting which labels are synced.
      - name: Apply labels from changed paths
        uses: actions/labeler@v5
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          configuration-path: .github/labeler.yml
          sync-labels: true


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

Comment on lines +170 to +181
const managedLabels = [
"bug",
"feature",
"documentation",
"question",
"security",
"kind: bug",
"kind: feature",
"kind: documentation",
"kind: question",
"kind: security",
];
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

managedLabels includes kind: ... labels, but this workflow never adds those labels to expected and ensure-labels doesn't create them. Consider removing the kind: entries or adding corresponding label creation + rules so the managed set matches what the workflow actually applies.

Copilot uses AI. Check for mistakes.
Comment on lines 182 to +195
@@ -169,7 +192,7 @@ jobs:
],
},
{
label: "kind: bug",
label: "bug",
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The issue-keyword labeling rules are duplicated in the backfill-open-issues job below. To avoid drift (e.g., updating patterns in one place but not the other), consider extracting the rules/managed label list into a single source (separate JS file in repo, or a reusable composite action) and reusing it in both jobs.

Copilot uses AI. Check for mistakes.
Comment on lines +335 to +349
def load_label_patterns():
mapping = {}
current_label = None
with open(".github/labeler.yml", "r", encoding="utf-8") as handle:
for raw_line in handle:
stripped = raw_line.strip()
if not stripped or stripped.startswith("#"):
continue
if stripped.startswith('"') and stripped.endswith('":'):
current_label = stripped[:-1].strip('"')
mapping[current_label] = []
continue
if stripped.startswith('- "') and current_label:
mapping[current_label].append(stripped[3:-1])
return mapping
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

This YAML parsing in load_label_patterns() is format-dependent (requires quoted label keys and quoted glob lines) and will silently break if .github/labeler.yml is reformatted or expanded (e.g., unquoted keys, additional list items). Consider using a real YAML parser, or at least relaxing the heuristics to handle unquoted keys and unquoted glob entries so backfill stays aligned with the labeler config.

Copilot uses AI. Check for mistakes.
Comment on lines +404 to +415
const managedLabels = [
"bug",
"feature",
"documentation",
"question",
"security",
"kind: bug",
"kind: feature",
"kind: documentation",
"kind: question",
"kind: security",
];
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

Same as above: managedLabels includes kind: labels that aren't created by ensure-labels and aren't produced by the rules in this job. Align the managed list with the labels the workflow can actually apply (or add kind: label creation + keyword rules).

Copilot uses AI. Check for mistakes.
@sapnilbiswas sapnilbiswas merged commit 35209f4 into Stanzin7:master Apr 8, 2026
14 checks passed
@sapnilbiswas sapnilbiswas deleted the codex/auto-label-feature branch April 8, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: infra CI, deployment, database, or repository automation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants