Skip to content

Commit 321d5b5

Browse files
committed
Retry API authentication errors since these can be transient
1 parent 8ad4b6e commit 321d5b5

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/api-client.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ test("getApiClient", async (t) => {
3636
baseUrl: "http://api.github.localhost",
3737
log: sinon.match.any,
3838
userAgent: `CodeQL-Action/${actionsUtil.getActionVersion()}`,
39+
retry: {
40+
doNotRetry: [400, 410, 422, 451],
41+
},
3942
}),
4043
);
4144
});

src/api-client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ function createApiClientWithDetails(
5151
warn: core.warning,
5252
error: core.error,
5353
},
54+
retry: {
55+
// The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors
56+
// with authentication, so we remove 401, 403, and 404 from the default list to ensure that
57+
// these errors are retried.
58+
doNotRetry: [400, 410, 422, 451],
59+
},
5460
}),
5561
);
5662
}

0 commit comments

Comments
 (0)