Skip to content

Commit

Permalink
fix: parallel check requests and error handling (#150)
Browse files Browse the repository at this point in the history
* fix: parallel check requests and error handling

* build: release v2.1.2
  • Loading branch information
pozil authored Jan 3, 2025
1 parent f09bc3b commit c015a6a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auto-assign-issue",
"version": "2.1.1",
"version": "2.1.2",
"private": true,
"description": "GitHub action that auto-assigns issues to users",
"main": "src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ describe('action', () => {
});

it('fails if user cannot be assigned and failsIfUsersCannotBeAssigned flag is true', async () => {
const requestMock = jest.fn(() => Promise.resolve({ status: 404 }));
const requestMock = jest.fn(() => Promise.reject({ status: 404 }));
const octokitMock = getOctokitMock({ requestMock });

await expect(
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ const checkIfUsersCanBeAssigned = async (
);
requests.push(request);
}
const responses = await Promise.all(requests);
const responses = await Promise.allSettled(requests);
const result = { isSuccess: true, assigneeErrors: [] };
for (let i = 0; i < assignees.length; i++) {
const { status } = responses[i];
if (status != 204) {
if (status === 'rejected') {
result.isSuccess = false;
result.assigneeErrors.push(assignees[i]);
}
Expand Down

0 comments on commit c015a6a

Please sign in to comment.