|
1 | 1 | import * as core from "@actions/core"; |
2 | 2 | import * as githubUtils from "@actions/github/lib/utils"; |
| 3 | +import type { OctokitOptions } from "@octokit/core"; |
3 | 4 | import * as retry from "@octokit/plugin-retry"; |
4 | 5 | import { RequestRequestOptions } from "@octokit/types"; |
5 | 6 | import { |
@@ -133,22 +134,24 @@ function createApiClientWithDetails( |
133 | 134 | (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth; |
134 | 135 | const retryingOctokit = githubUtils.GitHub.plugin(retry.retry); |
135 | 136 | const requestOptions = makeProxyRequestOptions(proxy); |
136 | | - return new retryingOctokit( |
137 | | - githubUtils.getOctokitOptions(auth, { |
138 | | - baseUrl: apiDetails.apiURL, |
139 | | - userAgent: `CodeQL-Action/${getActionVersion()}`, |
140 | | - log: { |
141 | | - debug: core.debug, |
142 | | - info: core.info, |
143 | | - warn: core.warning, |
144 | | - error: core.error, |
145 | | - }, |
146 | | - request: requestOptions, |
147 | | - retry: { |
148 | | - doNotRetry: DO_NOT_RETRY_STATUSES, |
149 | | - }, |
150 | | - }), |
151 | | - ); |
| 137 | + |
| 138 | + const opts: OctokitOptions = { |
| 139 | + auth: auth !== undefined ? `token ${auth}` : undefined, |
| 140 | + baseUrl: apiDetails.apiURL, |
| 141 | + userAgent: `CodeQL-Action/${getActionVersion()}`, |
| 142 | + log: { |
| 143 | + debug: core.debug, |
| 144 | + info: core.info, |
| 145 | + warn: core.warning, |
| 146 | + error: core.error, |
| 147 | + }, |
| 148 | + request: requestOptions, |
| 149 | + retry: { |
| 150 | + doNotRetry: DO_NOT_RETRY_STATUSES, |
| 151 | + }, |
| 152 | + }; |
| 153 | + |
| 154 | + return new retryingOctokit(opts); |
152 | 155 | } |
153 | 156 |
|
154 | 157 | /** |
|
0 commit comments