Fix @ts-check regressions in setup JS scripts causing CI js job failure#27060
Merged
Fix @ts-check regressions in setup JS scripts causing CI js job failure#27060
js job failure#27060Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/abb93850-d2bc-4346-857c-01913c585678 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/abb93850-d2bc-4346-857c-01913c585678 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/abb93850-d2bc-4346-857c-01913c585678 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
April 18, 2026 16:21
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes CI js job failures caused by stricter @ts-check / JSDoc type checking in the Actions setup JS scripts, by adding explicit narrowing and more precise JSDoc types.
Changes:
- Add explicit
prNumber === nullguard inadd_reviewer.cjsto keep reviewer payload types non-nullable. - Tighten invocation context and payload/repo extraction typing/narrowing to avoid unsafe property access under
@ts-check. - Normalize gateway config objects (servers + headers) to typed records using
Object.fromEntries(...)with filtering for string header values.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/invocation_context_helpers.cjs | Replaces any casts with explicit object-shape narrowing for repo/payload extraction. |
| actions/setup/js/convert_gateway_config_shared.cjs | Normalizes mcpServers into a new object via Object.entries/Object.fromEntries. |
| actions/setup/js/convert_gateway_config_codex.cjs | Filters dynamic header values to Record<string, string> before using Authorization. |
| actions/setup/js/add_workflow_run_comment.cjs | Adds explicit JSDoc typing for optional invocationContext parameter. |
| actions/setup/js/add_reviewer.cjs | Adds explicit guard to prevent null PR number from flowing into API request payload typing. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 2
| let servers = {}; | ||
| if (rawServers && typeof rawServers === "object" && !Array.isArray(rawServers)) { | ||
| servers = /** @type {Record<string, Record<string, unknown>>} */ rawServers; | ||
| servers = Object.fromEntries(Object.entries(rawServers)); |
Comment on lines
+232
to
+236
| * source: "native" | "workflow_dispatch" | "repository_dispatch"; | ||
| * eventName: string; | ||
| * eventPayload: any; | ||
| * workflowRepo: { owner: string, repo: string }; | ||
| * eventRepo: { owner: string, repo: string }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CI
jsjob failed ontsc --noEmitdue to stricter JSDoc type checking across workflow-comment, reviewer, invocation-context, and gateway-config scripts. This change narrows nullable/object inputs explicitly so existing behavior remains type-safe under@ts-check.Reviewer request typing (
add_reviewer.cjs)prNumber === nullguard before constructing the reviewer request payload.number | nullassignment path topull_number: number.Invocation context typing (
add_workflow_run_comment.cjs,invocation_context_helpers.cjs)invocationContextargument inaddCommentWithWorkflowLink.objectvalues.Gateway config object normalization (
convert_gateway_config_shared.cjs,convert_gateway_config_codex.cjs)mcpServersusingObject.fromEntries(Object.entries(...))into a typed record.Record<string, string>by filtering non-string header values before usingAuthorization.