You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cleaned actions/setup/js/assign_agent_helpers.cjs as part of the daily jsweep JavaScript unbloat process.
Context: github-script (uses global github, core, context)
Changes
assign_agent_helpers.cjs
Fix variable shadowing (bug fix)
Renamed inner agentName → assigneeAgentName in the allowedAgents filter callback inside assignAgentToIssue. The inner variable was shadowing the outer agentName function parameter, which is a JavaScript anti-pattern that can lead to confusing bugs.
Simplify debug message building
Replaced imperative string concatenation (let debugMsg = ...; if (x) debugMsg += ...) with a declarative array spread pattern, making the conditional parts clearer and more readable.
Property shorthand
Used assignableId shorthand instead of assignableId: assignableId in the fallback mutation variables object.
assign_agent_helpers.test.cjs
Added 5 new tests for getPullRequestDetails
getPullRequestDetails was exported and used by assign_to_agent.cjs but had zero test coverage.
Original error: Validation Failed: {"resource":"Label","code":"unprocessable","field":"data","message":"Could not resolve to a node with the global id of 'PR_kwDOPc1QR87OOJzM'."}
Summary
Cleaned
actions/setup/js/assign_agent_helpers.cjsas part of the daily jsweep JavaScript unbloat process.Context: github-script (uses global
github,core,context)Changes
assign_agent_helpers.cjsFix variable shadowing (bug fix)
agentName→assigneeAgentNamein theallowedAgentsfilter callback insideassignAgentToIssue. The inner variable was shadowing the outeragentNamefunction parameter, which is a JavaScript anti-pattern that can lead to confusing bugs.Simplify debug message building
let debugMsg = ...; if (x) debugMsg += ...) with a declarative array spread pattern, making the conditional parts clearer and more readable.Property shorthand
assignableIdshorthand instead ofassignableId: assignableIdin the fallback mutation variables object.assign_agent_helpers.test.cjsAdded 5 new tests for
getPullRequestDetailsgetPullRequestDetailswas exported and used byassign_to_agent.cjsbut had zero test coverage.Test improvements
getPullRequestDetails)✅ Validation checks
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓Note
This was originally intended as a pull request, but PR creation failed. The changes have been pushed to the branch
jsweep/assign-agent-helpers-7ada000fce058c24.Original error: Validation Failed: {"resource":"Label","code":"unprocessable","field":"data","message":"Could not resolve to a node with the global id of 'PR_kwDOPc1QR87OOJzM'."}
To create the pull request manually:
gh pr create --title "[jsweep] Clean assign_agent_helpers.cjs" --base main --head jsweep/assign-agent-helpers-7ada000fce058c24 --repo github/gh-awShow patch preview (176 of 176 lines)