Skip to content

fix(ci): label frontend changes by file type - #247

Open
IanHollow wants to merge 1 commit into
Anyesh:mainfrom
IanHollow:fix/pr-labeler-typescript
Open

IanHollow wants to merge 1 commit into
Anyesh:mainfrom
IanHollow:fix/pr-labeler-typescript

Conversation

@IanHollow

@IanHollow IanHollow commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

The labeler currently assigns javascript to every change under frontend/, including TypeScript, CSS, and package files. Split that rule into three labels:

  • frontend for any file in the frontend directory
  • typescript for .ts and .tsx files
  • javascript for .js, .jsx, .mjs, and .cjs files

The workflow can create the two new labels and now removes configured labels that no longer match when a PR is updated. Editing a PR also refreshes its labels.

Type of change

  • Bug fix
  • CI/CD change

Testing

  • Parsed both YAML files and checked the label rules against TypeScript, CSS, package, JavaScript, and backend paths.
  • Ran git diff --check.
  • Reviewed PR chore(frontend): migrate to Tailwind CSS 4 #246's changed files. It changes two JavaScript config files, so it will correctly keep javascript alongside typescript after relabeling.

Checklist

  • Read CONTRIBUTING.md.
  • Checked the actions/labeler v7 rules and permissions.
  • Added no application code or user-facing text.

Additional notes

The labeler runs from the base branch on pull_request_target and does not check out PR code. After this PR merges, existing open PRs will use the new rules when they receive an edit, new commit, or reopen event. The new rules cannot relabel this PR while they are still only on its branch.

Summary by Sourcery

Improve pull request labeling so frontend changes are classified by directory and file type.

Bug Fixes:

  • Correct frontend pull request labels so TypeScript, JavaScript, and other frontend changes receive the appropriate classifications.

Enhancements:

  • Add a general frontend label alongside file-type-specific labels for frontend changes.

CI:

  • Refresh pull request labels when edits occur and remove configured labels that no longer match.

@sourcery-ai

sourcery-ai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the GitHub labeler to apply frontend, typescript, and appropriately scoped javascript labels based on changed file paths, while enabling label refresh and removal of stale labels on edited and other PR events.

Sequence diagram for PR label refresh events

sequenceDiagram
    participant Author
    participant GitHub
    participant LabelerWorkflow
    participant ActionsLabeler
    participant PR
    Author->>GitHub: Open, synchronize, reopen, or edit PR
    GitHub->>LabelerWorkflow: pull_request_target event
    LabelerWorkflow->>ActionsLabeler: Run with GITHUB_TOKEN
    ActionsLabeler->>PR: Evaluate changed files
    ActionsLabeler->>PR: Add matching labels
    ActionsLabeler->>PR: Remove stale configured labels
    PR-->>Author: Refreshed labels
Loading

Flow diagram for frontend PR label assignment

flowchart TD
    A[Changed files in PR] --> B{Path matches frontend/**}
    B -->|yes| C[Add frontend label]
    B -->|no| D[No frontend label]
    C --> E{File extension matches}
    E -->|.ts or .tsx| F[Add typescript label]
    E -->|.js .jsx .mjs or .cjs| G[Add javascript label]
    E -->|other| H[No language label]
    D --> I[Other configured rules]
    F --> J[Sync labels]
    G --> J
    H --> J
    I --> J
    J --> K[Remove stale configured labels]
Loading

File-Level Changes

Change Details Files
Split frontend labeling by directory and file extension.
  • Retain a broad frontend label for all frontend paths.
  • Add typescript matching .ts and .tsx files.
  • Restrict javascript to .js, .jsx, .mjs, and .cjs files.
.github/labeler.yml
Refresh and synchronize labels during pull request lifecycle events.
  • Run labeling on PR edits in addition to open, synchronize, and reopen events.
  • Grant the workflow issue write permission required for label management.
  • Enable sync-labels so stale configured labels are removed.
.github/workflows/labeler.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Oct 5, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the label patterns or sync behavior are wrong, the workflow can add or remove labels on pull requests and issues, including manually applied labels that reverting will not restore automatically. The damage is bounded and can be repaired by relabeling, while the added issues-write permission expands what the CI token can change.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants