mirror of
https://github.com/github/codeql-action.git
synced 2025-12-07 00:08:06 +08:00
Compare commits
2 Commits
v3.31.1
...
mbg/api/re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
456086d251 | ||
|
|
d71accc5fa |
9
lib/analyze-action-post.js
generated
9
lib/analyze-action-post.js
generated
@@ -117076,6 +117076,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
}
|
||||
function wrapError(error2) {
|
||||
return error2 instanceof Error ? error2 : new Error(String(error2));
|
||||
}
|
||||
@@ -117195,6 +117198,9 @@ var githubUtils = __toESM(require_utils4());
|
||||
var retry = __toESM(require_dist_node15());
|
||||
var import_console_log_level = __toESM(require_console_log_level());
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -117202,7 +117208,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/analyze-action.js
generated
6
lib/analyze-action.js
generated
@@ -90177,6 +90177,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -90184,7 +90187,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/autobuild-action.js
generated
6
lib/autobuild-action.js
generated
@@ -77902,6 +77902,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -77909,7 +77912,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/init-action-post.js
generated
6
lib/init-action-post.js
generated
@@ -128396,6 +128396,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -128403,7 +128406,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/init-action.js
generated
6
lib/init-action.js
generated
@@ -86029,6 +86029,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -86036,7 +86039,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/resolve-environment-action.js
generated
6
lib/resolve-environment-action.js
generated
@@ -77910,6 +77910,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -77917,7 +77920,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
9
lib/start-proxy-action-post.js
generated
9
lib/start-proxy-action-post.js
generated
@@ -117042,6 +117042,9 @@ var ConfigurationError = class extends Error {
|
||||
super(message);
|
||||
}
|
||||
};
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
}
|
||||
function getErrorMessage(error2) {
|
||||
return error2 instanceof Error ? error2.message : String(error2);
|
||||
}
|
||||
@@ -117078,6 +117081,9 @@ var githubUtils = __toESM(require_utils4());
|
||||
var retry = __toESM(require_dist_node15());
|
||||
var import_console_log_level = __toESM(require_console_log_level());
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -117085,7 +117091,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
9
lib/start-proxy-action.js
generated
9
lib/start-proxy-action.js
generated
@@ -49321,6 +49321,9 @@ async function delay(milliseconds, opts) {
|
||||
}
|
||||
});
|
||||
}
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
}
|
||||
function getErrorMessage(error2) {
|
||||
return error2 instanceof Error ? error2.message : String(error2);
|
||||
}
|
||||
@@ -49370,6 +49373,9 @@ var core6 = __toESM(require_core());
|
||||
var githubUtils = __toESM(require_utils4());
|
||||
var retry = __toESM(require_dist_node15());
|
||||
var import_console_log_level = __toESM(require_console_log_level());
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -49377,7 +49383,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/upload-lib.js
generated
6
lib/upload-lib.js
generated
@@ -88523,6 +88523,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -88530,7 +88533,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
9
lib/upload-sarif-action-post.js
generated
9
lib/upload-sarif-action-post.js
generated
@@ -117042,6 +117042,9 @@ var ConfigurationError = class extends Error {
|
||||
super(message);
|
||||
}
|
||||
};
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
}
|
||||
function getErrorMessage(error2) {
|
||||
return error2 instanceof Error ? error2.message : String(error2);
|
||||
}
|
||||
@@ -117082,6 +117085,9 @@ var githubUtils = __toESM(require_utils4());
|
||||
var retry = __toESM(require_dist_node15());
|
||||
var import_console_log_level = __toESM(require_console_log_level());
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -117089,7 +117095,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
6
lib/upload-sarif-action.js
generated
6
lib/upload-sarif-action.js
generated
@@ -88775,6 +88775,9 @@ function parseRepositoryNwo(input) {
|
||||
|
||||
// src/api-client.ts
|
||||
var GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
|
||||
function getRetryConfig() {
|
||||
return isInTestMode() ? { retries: 10, retryAfterBaseValue: 1e4 } : { retries: 3, retryAfterBaseValue: 1e3 };
|
||||
}
|
||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
||||
const auth = allowExternal && apiDetails.externalRepoAuth || apiDetails.auth;
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
@@ -88782,7 +88785,8 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: (0, import_console_log_level.default)({ level: "debug" })
|
||||
log: (0, import_console_log_level.default)({ level: "debug" }),
|
||||
retry: getRetryConfig()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ test("getApiClient", async (t) => {
|
||||
baseUrl: "http://api.github.localhost",
|
||||
log: sinon.match.any,
|
||||
userAgent: `CodeQL-Action/${actionsUtil.getActionVersion()}`,
|
||||
retry: api.getRetryConfig(),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
GitHubVariant,
|
||||
GitHubVersion,
|
||||
isHTTPError,
|
||||
isInTestMode,
|
||||
parseGitHubUrl,
|
||||
parseMatrixInput,
|
||||
} from "./util";
|
||||
@@ -38,6 +39,20 @@ export interface GitHubApiExternalRepoDetails {
|
||||
apiURL: string | undefined;
|
||||
}
|
||||
|
||||
export function getRetryConfig(): {
|
||||
retries: number;
|
||||
retryAfterBaseValue?: number;
|
||||
} {
|
||||
// If we are in test mode, increase the allowed number of retries to 10
|
||||
// and the base backoff from 1s to 10s. `plugin-retry` will wait
|
||||
// `(failedAttempts ^ 2) * retryAfterBaseValue`-long (in ms) after
|
||||
// each failed attempt.
|
||||
// If we are not in test mode, we use the default configuration.
|
||||
return isInTestMode()
|
||||
? { retries: 10, retryAfterBaseValue: 10_000 }
|
||||
: { retries: 3, retryAfterBaseValue: 1_000 };
|
||||
}
|
||||
|
||||
function createApiClientWithDetails(
|
||||
apiDetails: GitHubApiCombinedDetails,
|
||||
{ allowExternal = false } = {},
|
||||
@@ -50,6 +65,7 @@ function createApiClientWithDetails(
|
||||
baseUrl: apiDetails.apiURL,
|
||||
userAgent: `CodeQL-Action/${getActionVersion()}`,
|
||||
log: consoleLogLevel({ level: "debug" }),
|
||||
retry: getRetryConfig(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user