Closed Vishnu-0609 closed 1 month ago
Thanks for the PR. Please make sure that it meets our contributing requirements, specifically to make lint job succeed, and the commit to adhere to conventional commits guidelines. Check out the comments by myself and Nico.
@Vishnu-0609 Do you plan to update your contribution? We'd otherwise close it and attempt a fix another time.
Let's ensure the first assignee (+ offset) is simply chosen if there is no last assignee.
This PR fixes TypeError in the this code "const lastIndex = findIndex(candidates, c => c.login === lastAssignee.login);" people facing this problem "TypeError: Cannot read properties of null (reading 'login') at /home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:29256:73 at /home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:31378:9 at forEach (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:31440:16) at findIndex (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:31377:3) at getNextAssignee (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:29256:21) at /home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:32262:10 at Array.map ()
at run (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:32259:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
solution :=
function getNextAssignee(candidates, lastAssignee={login:""}, offset = 1) { const lastIndex = findIndex(candidates, c => c.login === lastAssignee?.login);
// ensure assignee was a valid moderator if (lastIndex === -1) { return null; }
return candidates[(lastIndex + offset) % candidates.length]; }
assign a default value in getNextAssignee function parameter lastAssignee={login:""} so peoples don't face this typeError.
Fixes #27