Fix add_labels strict-mode narrowing for CJS lint/typecheck#46589
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
add_labels strict-mode narrowing for CJS lint/typecheck
There was a problem hiding this comment.
Pull request overview
Refactors strict-mode label validation so TypeScript correctly narrows structured label inputs without changing runtime behavior.
Changes:
- Replaces
filter().map()with explicit object narrowing. - Preserves metadata validation and fallback label naming.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/add_labels.cjs |
Makes strict-mode structured-label validation type-safe. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Medium
|
@copilot please run the Run: https://github.com/github/gh-aw/actions/runs/29683215651 Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "pi.dev"See Network Configuration for more information.
|
|
🎉 This pull request is included in a new release. Release: |
The CJS workflow was failing on
actions/setup/js/add_labels.cjsbecause the strictissue_intentmetadata check did not narrow mixed label inputs cleanly for TypeScript. This change keeps the existing validation semantics while making the structured-label path explicit to the checker.Problem
message.labelsaccepts both strings and structured label objects.issue_intentmode, the missing-metadata check leftlabel.nameon a union type that TypeScript could not prove was object-shaped.Change
filter(...).map(...)path with a single loop that:rationaleorconfidence.Behavior preserved
"<unnamed>".Illustrative snippet