Merged
Conversation
- Replace for loop with for...of entries() iteration - Simplify isAuthError check using array .some() pattern - Add test for per-item pull_request_repo rejection Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Cleans up assign_to_agent as part of the jsweep JavaScript unbloat effort, and adds a regression test for per-item pull_request_repo allowlist validation.
Changes:
- Refactors the per-item processing loop to use
itemsToProcess.entries()for cleaner indexing + item access. - Simplifies authentication/permission error detection using an
Array.some(...)substring match. - Adds a test covering rejection of per-item
pull_request_repovalues not present in the allowed list.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
actions/setup/js/assign_to_agent.cjs |
Refactors iteration style and streamlines auth-error substring detection logic. |
actions/setup/js/assign_to_agent.test.cjs |
Adds coverage for the E004 validation path when a per-item PR repo is not allowlisted. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
Summary
Cleaned
assign_to_agent.cjsas part of the jsweep JavaScript unbloat initiative.Context: github-script context (uses
core,github,contextglobals)Changes
assign_to_agent.cjsfor (let i = 0; i < itemsToProcess.length; i++)withfor (const [i, item] of itemsToProcess.entries())— removes redundant manual indexing andconst item = itemsToProcess[i]declaration||chain forisAuthErrorwith a more readablearray.some(msg => errorMessage.includes(msg))patternassign_to_agent.test.cjs"should reject per-item pull_request_repo not in allowed list"— covers the validation path initem.pull_request_repohandling that was previously untested (tests the E004 error when a per-item PR repo is not in the allowed list)Test Results
it.skiptests)✅ Validation Checks
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓vitest run assign_to_agent.test.cjs— 36 passed, 3 skipped ✓