initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
14
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/error-request.js
generated
vendored
Normal file
14
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/error-request.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
async function errorRequest(state, octokit, error, options) {
|
||||
if (!error.request || !error.request.request) {
|
||||
throw error;
|
||||
}
|
||||
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
|
||||
const retries = options.request.retries != null ? options.request.retries : state.retries;
|
||||
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
|
||||
throw octokit.retry.retryRequest(error, retries, retryAfter);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
export {
|
||||
errorRequest
|
||||
};
|
||||
35
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
Normal file
35
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { Octokit } from "@octokit/core";
|
||||
import { errorRequest } from "./error-request";
|
||||
import { wrapRequest } from "./wrap-request";
|
||||
const VERSION = "0.0.0-development";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign(
|
||||
{
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1e3,
|
||||
doNotRetry: [400, 401, 403, 404, 422, 451],
|
||||
retries: 3
|
||||
},
|
||||
octokitOptions.retry
|
||||
);
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, state, octokit));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state, octokit));
|
||||
}
|
||||
return {
|
||||
retry: {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries,
|
||||
retryAfter
|
||||
});
|
||||
return error;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
retry.VERSION = VERSION;
|
||||
export {
|
||||
VERSION,
|
||||
retry
|
||||
};
|
||||
4
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
Normal file
4
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const VERSION = "5.0.5";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
34
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/wrap-request.js
generated
vendored
Normal file
34
github/codeql-action-v2/node_modules/@octokit/plugin-retry/dist-src/wrap-request.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import Bottleneck from "bottleneck/light";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
import { errorRequest } from "./error-request";
|
||||
async function wrapRequest(state, octokit, request, options) {
|
||||
const limiter = new Bottleneck();
|
||||
limiter.on("failed", function(error, info) {
|
||||
const maxRetries = ~~error.request.request.retries;
|
||||
const after = ~~error.request.request.retryAfter;
|
||||
options.request.retryCount = info.retryCount + 1;
|
||||
if (maxRetries > info.retryCount) {
|
||||
return after * state.retryAfterBaseValue;
|
||||
}
|
||||
});
|
||||
return limiter.schedule(
|
||||
requestWithGraphqlErrorHandling.bind(null, state, octokit, request),
|
||||
options
|
||||
);
|
||||
}
|
||||
async function requestWithGraphqlErrorHandling(state, octokit, request, options) {
|
||||
const response = await request(request, options);
|
||||
if (response.data && response.data.errors && /Something went wrong while executing your query/.test(
|
||||
response.data.errors[0].message
|
||||
)) {
|
||||
const error = new RequestError(response.data.errors[0].message, 500, {
|
||||
request: options,
|
||||
response
|
||||
});
|
||||
return errorRequest(state, octokit, error, options);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
export {
|
||||
wrapRequest
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue