Merge branch 'main' into update-bundle/codeql-bundle-v2.13.4
This commit is contained in:
commit
3e0c87dc38
36 changed files with 771 additions and 213 deletions
70
.github/workflows/__resolve-environment-action.yml
generated
vendored
Normal file
70
.github/workflows/__resolve-environment-action.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# (cd pr-checks; pip install ruamel.yaml && python3 sync.py)
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Resolve environment
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
resolve-environment-action:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.4
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.4
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.4
|
||||
name: Resolve environment
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: >-
|
||||
runner.os != 'Windows' && (
|
||||
matrix.version == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- uses: ./../action/resolve-environment
|
||||
id: resolve-environment
|
||||
with:
|
||||
language: go
|
||||
|
||||
- name: Fail if no Go configuration was returned
|
||||
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
|
||||
run: exit 1
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
|
@ -3,6 +3,11 @@
|
|||
## [UNRELEASED]
|
||||
|
||||
- Update default CodeQL bundle version to 2.13.4. [#1721](https://github.com/github/codeql-action/pull/1721)
|
||||
- Experimental: add a new `resolve-environment` action which attempts to infer a configuration for the build environment that is required to build a given project. Do not use this in production as it is part of an internal experiment and subject to change at any time.
|
||||
|
||||
## 2.20.0 - 13 Jun 2023
|
||||
|
||||
- Bump the version of the Action to 2.20.0. This ensures that users who received a Dependabot upgrade to [`cdcdbb5`](https://github.com/github/codeql-action/commit/cdcdbb579706841c47f7063dda365e292e5cad7a), which was mistakenly marked as Action version 2.13.4, continue to receive updates to the CodeQL Action. Full details in [#1729](https://github.com/github/codeql-action/pull/1729)
|
||||
|
||||
## 2.3.6 - 01 Jun 2023
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
{ "maximumVersion": "3.10", "minimumVersion": "3.6" }
|
||||
{ "maximumVersion": "3.10", "minimumVersion": "3.5" }
|
||||
|
|
|
|||
25
lib/codeql.js
generated
25
lib/codeql.js
generated
|
|
@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
||||
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
|
|
@ -89,6 +89,10 @@ exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
|
|||
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
|
||||
*/
|
||||
exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
|
||||
/**
|
||||
* Versions 2.13.4+ of the CodeQL CLI support the `resolve build-environment` command.
|
||||
*/
|
||||
exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
|
||||
/**
|
||||
* Set up CodeQL CLI access.
|
||||
*
|
||||
|
|
@ -165,6 +169,7 @@ function setCodeQL(partialCodeql) {
|
|||
resolveLanguages: resolveFunction(partialCodeql, "resolveLanguages"),
|
||||
betterResolveLanguages: resolveFunction(partialCodeql, "betterResolveLanguages"),
|
||||
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
|
||||
resolveBuildEnvironment: resolveFunction(partialCodeql, "resolveBuildEnvironment"),
|
||||
packDownload: resolveFunction(partialCodeql, "packDownload"),
|
||||
databaseCleanup: resolveFunction(partialCodeql, "databaseCleanup"),
|
||||
databaseBundle: resolveFunction(partialCodeql, "databaseBundle"),
|
||||
|
|
@ -374,6 +379,24 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
|
||||
}
|
||||
},
|
||||
async resolveBuildEnvironment(workingDir, language) {
|
||||
const codeqlArgs = [
|
||||
"resolve",
|
||||
"build-environment",
|
||||
`--language=${language}`,
|
||||
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
|
||||
];
|
||||
if (workingDir !== undefined) {
|
||||
codeqlArgs.push("--working-dir", workingDir);
|
||||
}
|
||||
const output = await runTool(cmd, codeqlArgs);
|
||||
try {
|
||||
return JSON.parse(output);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Unexpected output from codeql resolve build-environment: ${e} in\n${output}`);
|
||||
}
|
||||
},
|
||||
async databaseRunQueries(databasePath, extraSearchPath, querySuitePath, flags, optimizeForLastQueryRun) {
|
||||
const codeqlArgs = [
|
||||
"database",
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
82
lib/resolve-environment-action.js
generated
Normal file
82
lib/resolve-environment-action.js
generated
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const resolve_environment_1 = require("./resolve-environment");
|
||||
const util_1 = require("./util");
|
||||
const ACTION_NAME = "resolve-environment";
|
||||
const ENVIRONMENT_OUTPUT_NAME = "environment";
|
||||
async function run() {
|
||||
const startedAt = new Date();
|
||||
const logger = (0, logging_1.getActionsLogger)();
|
||||
const language = (0, languages_1.resolveAlias)((0, actions_util_1.getRequiredInput)("language"));
|
||||
try {
|
||||
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)(ACTION_NAME, "starting", startedAt)))) {
|
||||
return;
|
||||
}
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
||||
const config = await configUtils.getConfig((0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||
if (config === undefined) {
|
||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||
}
|
||||
const workingDirectory = (0, actions_util_1.getOptionalInput)("working-directory");
|
||||
const result = await (0, resolve_environment_1.runResolveBuildEnvironment)(config.codeQLCmd, logger, workingDirectory, language);
|
||||
core.setOutput(ENVIRONMENT_OUTPUT_NAME, result);
|
||||
}
|
||||
catch (unwrappedError) {
|
||||
const error = (0, util_1.wrapError)(unwrappedError);
|
||||
if (error instanceof codeql_1.CommandInvocationError) {
|
||||
// If the CLI failed to run successfully for whatever reason,
|
||||
// we just return an empty JSON object and proceed with the workflow.
|
||||
core.setOutput(ENVIRONMENT_OUTPUT_NAME, {});
|
||||
logger.warning(`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`);
|
||||
}
|
||||
else {
|
||||
// For any other error types, something has more seriously gone wrong and we fail.
|
||||
core.setFailed(`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`);
|
||||
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)(ACTION_NAME, (0, actions_util_1.getActionsStatus)(error), startedAt, error.message, error.stack));
|
||||
}
|
||||
return;
|
||||
}
|
||||
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)(ACTION_NAME, "success", startedAt));
|
||||
}
|
||||
async function runWrapper() {
|
||||
try {
|
||||
await run();
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`${ACTION_NAME} action failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
}
|
||||
await (0, util_1.checkForTimeout)();
|
||||
}
|
||||
void runWrapper();
|
||||
//# sourceMappingURL=resolve-environment-action.js.map
|
||||
1
lib/resolve-environment-action.js.map
Normal file
1
lib/resolve-environment-action.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAOwB;AACxB,6CAAgD;AAChD,qCAAkD;AAClD,4DAA8C;AAC9C,2CAAqD;AACrD,uCAA6C;AAC7C,+DAAmE;AACnE,iCAA+E;AAE/E,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,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,wFAAwF,KAAK,CAAC,OAAO,EAAE,CACxG,CAAC;YAEF,MAAM,IAAA,+BAAgB,EACpB,MAAM,IAAA,qCAAsB,EAC1B,WAAW,EACX,IAAA,+BAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CACF,CAAC;SACH;QAED,OAAO;KACR;IAED,MAAM,IAAA,+BAAgB,EACpB,MAAM,IAAA,qCAAsB,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAChE,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,GAAG,WAAW,mBAAmB,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC7E;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
49
lib/resolve-environment.js
generated
Normal file
49
lib/resolve-environment.js
generated
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runResolveBuildEnvironment = void 0;
|
||||
const codeql_1 = require("./codeql");
|
||||
const util = __importStar(require("./util"));
|
||||
async function runResolveBuildEnvironment(cmd, logger, workingDir, language) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${language}`);
|
||||
const codeql = await (0, codeql_1.getCodeQL)(cmd);
|
||||
let result = {};
|
||||
// If the CodeQL version in use does not support the `resolve build-environment`
|
||||
// command, just return an empty configuration. Otherwise invoke the CLI.
|
||||
if (!(await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_RESOLVE_ENVIRONMENT))) {
|
||||
logger.warning("Unsupported CodeQL CLI version for `resolve build-environment` command, " +
|
||||
"returning an empty configuration.");
|
||||
}
|
||||
else {
|
||||
if (workingDir !== undefined) {
|
||||
logger.info(`Using ${workingDir} as the working directory.`);
|
||||
}
|
||||
result = await codeql.resolveBuildEnvironment(workingDir, language);
|
||||
}
|
||||
logger.endGroup();
|
||||
return result;
|
||||
}
|
||||
exports.runResolveBuildEnvironment = runResolveBuildEnvironment;
|
||||
//# sourceMappingURL=resolve-environment.js.map
|
||||
1
lib/resolve-environment.js.map
Normal file
1
lib/resolve-environment.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"resolve-environment.js","sourceRoot":"","sources":["../src/resolve-environment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyE;AAGzE,6CAA+B;AAExB,KAAK,UAAU,0BAA0B,CAC9C,GAAW,EACX,MAAc,EACd,UAA8B,EAC9B,QAAkB;IAElB,MAAM,CAAC,UAAU,CAAC,+CAA+C,QAAQ,EAAE,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,gFAAgF;IAChF,yEAAyE;IACzE,IACE,CAAC,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,2CAAkC,CAAC,CAAC,EAC5E;QACA,MAAM,CAAC,OAAO,CACZ,0EAA0E;YACxE,mCAAmC,CACtC,CAAC;KACH;SAAM;QACL,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,SAAS,UAAU,4BAA4B,CAAC,CAAC;SAC9D;QAED,MAAM,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACrE;IAED,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BD,gEA8BC"}
|
||||
21
lib/upload-lib.js
generated
21
lib/upload-lib.js
generated
|
|
@ -359,16 +359,21 @@ function handleProcessingResultForUnsuccessfulExecution(response, status, logger
|
|||
response.data.errors.length === 1 &&
|
||||
response.data.errors[0].toString().startsWith("unsuccessful execution")) {
|
||||
logger.debug("Successfully uploaded a SARIF file for the unsuccessful execution. Received expected " +
|
||||
'"unsuccessful execution" error, and no other errors.');
|
||||
'"unsuccessful execution" processing error, and no other errors.');
|
||||
}
|
||||
else if (status === "failed") {
|
||||
logger.warning(`Failed to upload a SARIF file for the unsuccessful execution. Code scanning status ` +
|
||||
`information for the repository may be out of date as a result. Processing errors: ${response.data.errors}`);
|
||||
}
|
||||
else if (status === "complete") {
|
||||
// There is a known transient issue with the code scanning API where it sometimes reports
|
||||
// `complete` for an unsuccessful execution submission.
|
||||
logger.debug("Uploaded a SARIF file for the unsuccessful execution, but did not receive the expected " +
|
||||
'"unsuccessful execution" processing error. This is a known transient issue with the ' +
|
||||
"code scanning API, and does not cause out of date code scanning status information.");
|
||||
}
|
||||
else {
|
||||
const shortMessage = "Failed to upload a SARIF file for the unsuccessful execution. Code scanning status " +
|
||||
"information for the repository may be out of date as a result.";
|
||||
const longMessage = shortMessage + status === "failed"
|
||||
? ` Processing errors: ${response.data.errors}`
|
||||
: ' Encountered no processing errors, but expected to receive an "unsuccessful execution" error.';
|
||||
logger.debug(longMessage);
|
||||
throw new Error(shortMessage);
|
||||
util.assertNever(status);
|
||||
}
|
||||
}
|
||||
function validateUniqueCategory(sarif) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
10
node_modules/.package-lock.json
generated
vendored
10
node_modules/.package-lock.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codeql",
|
||||
"version": "2.3.7",
|
||||
"version": "2.20.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
@ -596,15 +596,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-retry": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-4.0.4.tgz",
|
||||
"integrity": "sha512-d7qGFLR3AH+WbNEDUvBPgMc7wRCxU40FZyNXFFqs8ISw75ZYS5/P3ScggzU13dCoY0aywYDxKugGstQTwNgppA==",
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-5.0.2.tgz",
|
||||
"integrity": "sha512-/Z7rWLCfjwmaVdyFuMkZoAnhfrvYgtvDrbO2d6lv7XrvJa8gFGB5tLUMngfuyMBfDCc5B9+EVu7IkQx5ebVlMg==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"bottleneck": "^2.15.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=3"
|
||||
|
|
|
|||
115
node_modules/@octokit/plugin-retry/dist-node/index.js
generated
vendored
115
node_modules/@octokit/plugin-retry/dist-node/index.js
generated
vendored
|
|
@ -1,63 +1,107 @@
|
|||
'use strict';
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
// pkg/dist-src/index.js
|
||||
var dist_src_exports = {};
|
||||
__export(dist_src_exports, {
|
||||
VERSION: () => VERSION,
|
||||
retry: () => retry
|
||||
});
|
||||
module.exports = __toCommonJS(dist_src_exports);
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var Bottleneck = _interopDefault(require('bottleneck/light'));
|
||||
|
||||
// @ts-ignore
|
||||
async function errorRequest(octokit, state, error, options) {
|
||||
// pkg/dist-src/error-request.js
|
||||
async function errorRequest(state, octokit, error, options) {
|
||||
if (!error.request || !error.request.request) {
|
||||
// address https://github.com/octokit/plugin-retry.js/issues/8
|
||||
throw error;
|
||||
}
|
||||
// retry all >= 400 && not doNotRetry
|
||||
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);
|
||||
}
|
||||
// Maybe eventually there will be more cases here
|
||||
throw error;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-ignore
|
||||
async function wrapRequest(state, request, options) {
|
||||
const limiter = new Bottleneck();
|
||||
// @ts-ignore
|
||||
limiter.on("failed", function (error, info) {
|
||||
// pkg/dist-src/wrap-request.js
|
||||
var import_light = __toESM(require("bottleneck/light"));
|
||||
var import_request_error = require("@octokit/request-error");
|
||||
async function wrapRequest(state, octokit, request, options) {
|
||||
const limiter = new import_light.default();
|
||||
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) {
|
||||
// Returning a number instructs the limiter to retry
|
||||
// the request after that number of milliseconds have passed
|
||||
return after * state.retryAfterBaseValue;
|
||||
}
|
||||
});
|
||||
return limiter.schedule(request, options);
|
||||
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 import_request_error.RequestError(response.data.errors[0].message, 500, {
|
||||
request: options,
|
||||
response
|
||||
});
|
||||
return errorRequest(state, octokit, error, options);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
const VERSION = "4.0.4";
|
||||
// pkg/dist-src/index.js
|
||||
var VERSION = "5.0.2";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3
|
||||
}, octokitOptions.retry);
|
||||
const state = Object.assign(
|
||||
{
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1e3,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3
|
||||
},
|
||||
octokitOptions.retry
|
||||
);
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
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: retries,
|
||||
retryAfter: retryAfter
|
||||
retries,
|
||||
retryAfter
|
||||
});
|
||||
return error;
|
||||
}
|
||||
|
|
@ -65,7 +109,8 @@ function retry(octokit, octokitOptions) {
|
|||
};
|
||||
}
|
||||
retry.VERSION = VERSION;
|
||||
|
||||
exports.VERSION = VERSION;
|
||||
exports.retry = retry;
|
||||
//# sourceMappingURL=index.js.map
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
VERSION,
|
||||
retry
|
||||
});
|
||||
|
|
|
|||
8
node_modules/@octokit/plugin-retry/dist-node/index.js.map
generated
vendored
8
node_modules/@octokit/plugin-retry/dist-node/index.js.map
generated
vendored
|
|
@ -1 +1,7 @@
|
|||
{"version":3,"file":"index.js","sources":["../dist-src/error-request.js","../dist-src/wrap-request.js","../dist-src/index.js"],"sourcesContent":["// @ts-ignore\nexport async function errorRequest(octokit, state, error, options) {\n if (!error.request || !error.request.request) {\n // address https://github.com/octokit/plugin-retry.js/issues/8\n throw error;\n }\n // retry all >= 400 && not doNotRetry\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n // Maybe eventually there will be more cases here\n throw error;\n}\n","// @ts-ignore\nimport Bottleneck from \"bottleneck/light\";\n// @ts-ignore\nexport async function wrapRequest(state, request, options) {\n const limiter = new Bottleneck();\n // @ts-ignore\n limiter.on(\"failed\", function (error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n // Returning a number instructs the limiter to retry\n // the request after that number of milliseconds have passed\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(request, options);\n}\n","import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nexport const VERSION = \"4.0.4\";\nexport function retry(octokit, octokitOptions) {\n const state = Object.assign({\n enabled: true,\n retryAfterBaseValue: 1000,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3,\n }, octokitOptions.retry);\n if (state.enabled) {\n octokit.hook.error(\"request\", errorRequest.bind(null, octokit, state));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state));\n }\n return {\n retry: {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries: retries,\n retryAfter: retryAfter,\n });\n return error;\n },\n },\n };\n}\nretry.VERSION = VERSION;\n"],"names":["errorRequest","octokit","state","error","options","request","status","doNotRetry","includes","retries","retryAfter","Math","pow","retryCount","retry","retryRequest","wrapRequest","limiter","Bottleneck","on","info","maxRetries","after","retryAfterBaseValue","schedule","VERSION","octokitOptions","Object","assign","enabled","hook","bind","wrap"],"mappings":";;;;;;;;AAAA;AACO,eAAeA,YAAY,CAACC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,OAAO,EAAE;EAC/D,IAAI,CAACD,KAAK,CAACE,OAAO,IAAI,CAACF,KAAK,CAACE,OAAO,CAACA,OAAO,EAAE;;IAE1C,MAAMF,KAAK;;;EAGf,IAAIA,KAAK,CAACG,MAAM,IAAI,GAAG,IAAI,CAACJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACL,KAAK,CAACG,MAAM,CAAC,EAAE;IACjE,MAAMG,OAAO,GAAGL,OAAO,CAACC,OAAO,CAACI,OAAO,IAAI,IAAI,GAAGL,OAAO,CAACC,OAAO,CAACI,OAAO,GAAGP,KAAK,CAACO,OAAO;IACzF,MAAMC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAC,CAACR,OAAO,CAACC,OAAO,CAACQ,UAAU,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrE,MAAMZ,OAAO,CAACa,KAAK,CAACC,YAAY,CAACZ,KAAK,EAAEM,OAAO,EAAEC,UAAU,CAAC;;;EAGhE,MAAMP,KAAK;AACf;;ACdA;AACA,AACA;AACA,AAAO,eAAea,WAAW,CAACd,KAAK,EAAEG,OAAO,EAAED,OAAO,EAAE;EACvD,MAAMa,OAAO,GAAG,IAAIC,UAAU,EAAE;;EAEhCD,OAAO,CAACE,EAAE,CAAC,QAAQ,EAAE,UAAUhB,KAAK,EAAEiB,IAAI,EAAE;IACxC,MAAMC,UAAU,GAAG,CAAC,CAAClB,KAAK,CAACE,OAAO,CAACA,OAAO,CAACI,OAAO;IAClD,MAAMa,KAAK,GAAG,CAAC,CAACnB,KAAK,CAACE,OAAO,CAACA,OAAO,CAACK,UAAU;IAChDN,OAAO,CAACC,OAAO,CAACQ,UAAU,GAAGO,IAAI,CAACP,UAAU,GAA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ist-src/error-request.js", "../dist-src/wrap-request.js"],
|
||||
"sourcesContent": ["import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nconst VERSION = \"5.0.2\";\nfunction retry(octokit, octokitOptions) {\n const state = Object.assign(\n {\n enabled: true,\n retryAfterBaseValue: 1e3,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3\n },\n octokitOptions.retry\n );\n if (state.enabled) {\n octokit.hook.error(\"request\", errorRequest.bind(null, state, octokit));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state, octokit));\n }\n return {\n retry: {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries,\n retryAfter\n });\n return error;\n }\n }\n };\n}\nretry.VERSION = VERSION;\nexport {\n VERSION,\n retry\n};\n", "async function errorRequest(state, octokit, error, options) {\n if (!error.request || !error.request.request) {\n throw error;\n }\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n throw error;\n}\nexport {\n errorRequest\n};\n", "import Bottleneck from \"bottleneck/light\";\nimport { RequestError } from \"@octokit/request-error\";\nimport { errorRequest } from \"./error-request\";\nasync function wrapRequest(state, octokit, request, options) {\n const limiter = new Bottleneck();\n limiter.on(\"failed\", function(error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(\n requestWithGraphqlErrorHandling.bind(null, state, octokit, request),\n options\n );\n}\nasync function requestWithGraphqlErrorHandling(state, octokit, request, options) {\n const response = await request(request, options);\n if (response.data && response.data.errors && /Something went wrong while executing your query/.test(\n response.data.errors[0].message\n )) {\n const error = new RequestError(response.data.errors[0].message, 500, {\n request: options,\n response\n });\n return err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,GAAG;AACD,UAAM,QAAQ,IAAI,kCAAa,SAAS,KAAK,OAAO,CAAC,EAAE,SAAS,KAAK;AAAA,MACnE,SAAS;AAAA,MACT;AAAA,IACF,CAAC;AACD,WAAO,aAAa,OAAO,SAAS,OAAO,OAAO;AAAA,EACpD;AACA,SAAO;AACT;;;AF5BA,IAAM,UAAU;AAChB,SAAS,MAAM,SAAS,gBAAgB;AACtC,QAAM,QAAQ,OAAO;AAAA,IACnB;AAAA,MACE,SAAS;AAAA,MACT,qBAAqB;AAAA,MACrB,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,MACpC,SAAS;AAAA,IACX;AAAA,IACA,eAAe;AAAA,EACjB;AACA,MAAI,MAAM,SAAS;AACjB,YAAQ,KAAK,MAAM,WAAW,aAAa,KAAK,MAAM,OAAO,OAAO,CAAC;AACrE,YAAQ,KAAK,KAAK,WAAW,YAAY,KAAK,MAAM,OAAO,OAAO,CAAC;AAAA,EACrE;AACA,SAAO;AAAA,IACL,OAAO;AAAA,MACL,cAAc,CAAC,OAAO,SAAS,eAAe;AAC5C,cAAM,QAAQ,UAAU,OAAO,OAAO,CAAC,GAAG,MAAM,QAAQ,SAAS;AAAA,UAC/D;AAAA,UACA;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AACA,MAAM,UAAU;",
|
||||
"names": ["Bottleneck"]
|
||||
}
|
||||
|
|
|
|||
25
node_modules/@octokit/plugin-retry/dist-src/error-request.js
generated
vendored
25
node_modules/@octokit/plugin-retry/dist-src/error-request.js
generated
vendored
|
|
@ -1,15 +1,14 @@
|
|||
// @ts-ignore
|
||||
export async function errorRequest(octokit, state, error, options) {
|
||||
if (!error.request || !error.request.request) {
|
||||
// address https://github.com/octokit/plugin-retry.js/issues/8
|
||||
throw error;
|
||||
}
|
||||
// retry all >= 400 && not doNotRetry
|
||||
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);
|
||||
}
|
||||
// Maybe eventually there will be more cases here
|
||||
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
|
||||
};
|
||||
|
|
|
|||
51
node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
51
node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
|
|
@ -1,27 +1,34 @@
|
|||
import { errorRequest } from "./error-request";
|
||||
import { wrapRequest } from "./wrap-request";
|
||||
export const VERSION = "0.0.0-development";
|
||||
export function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3,
|
||||
}, octokitOptions.retry);
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
const VERSION = "0.0.0-development";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign(
|
||||
{
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1e3,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
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;
|
||||
}
|
||||
}
|
||||
return {
|
||||
retry: {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
retry.VERSION = VERSION;
|
||||
export {
|
||||
VERSION,
|
||||
retry
|
||||
};
|
||||
|
|
|
|||
5
node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
5
node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
|
|
@ -1 +1,4 @@
|
|||
export const VERSION = "4.0.4";
|
||||
const VERSION = "5.0.2";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
|
|
|
|||
48
node_modules/@octokit/plugin-retry/dist-src/wrap-request.js
generated
vendored
48
node_modules/@octokit/plugin-retry/dist-src/wrap-request.js
generated
vendored
|
|
@ -1,18 +1,34 @@
|
|||
// @ts-ignore
|
||||
import Bottleneck from "bottleneck/light";
|
||||
// @ts-ignore
|
||||
export async function wrapRequest(state, request, options) {
|
||||
const limiter = new Bottleneck();
|
||||
// @ts-ignore
|
||||
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) {
|
||||
// Returning a number instructs the limiter to retry
|
||||
// the request after that number of milliseconds have passed
|
||||
return after * state.retryAfterBaseValue;
|
||||
}
|
||||
});
|
||||
return limiter.schedule(request, options);
|
||||
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
|
||||
};
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-types/error-request.d.ts
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-types/error-request.d.ts
generated
vendored
|
|
@ -1 +1 @@
|
|||
export declare function errorRequest(octokit: any, state: any, error: any, options: any): Promise<void>;
|
||||
export declare function errorRequest(state: any, octokit: any, error: any, options: any): Promise<void>;
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-types/index.d.ts
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-types/index.d.ts
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { Octokit } from "@octokit/core";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
import type { RequestError } from "@octokit/request-error";
|
||||
export declare const VERSION = "0.0.0-development";
|
||||
export declare function retry(octokit: Octokit, octokitOptions: any): {
|
||||
retry: {
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-types/version.d.ts
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-types/version.d.ts
generated
vendored
|
|
@ -1 +1 @@
|
|||
export declare const VERSION = "4.0.4";
|
||||
export declare const VERSION = "5.0.2";
|
||||
|
|
|
|||
2
node_modules/@octokit/plugin-retry/dist-types/wrap-request.d.ts
generated
vendored
2
node_modules/@octokit/plugin-retry/dist-types/wrap-request.d.ts
generated
vendored
|
|
@ -1 +1 @@
|
|||
export declare function wrapRequest(state: any, request: any, options: any): Promise<any>;
|
||||
export declare function wrapRequest(state: any, octokit: any, request: any, options: any): Promise<any>;
|
||||
|
|
|
|||
130
node_modules/@octokit/plugin-retry/dist-web/index.js
generated
vendored
130
node_modules/@octokit/plugin-retry/dist-web/index.js
generated
vendored
|
|
@ -1,64 +1,78 @@
|
|||
import Bottleneck from 'bottleneck/light';
|
||||
|
||||
// @ts-ignore
|
||||
async function errorRequest(octokit, state, error, options) {
|
||||
if (!error.request || !error.request.request) {
|
||||
// address https://github.com/octokit/plugin-retry.js/issues/8
|
||||
throw error;
|
||||
}
|
||||
// retry all >= 400 && not doNotRetry
|
||||
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);
|
||||
}
|
||||
// Maybe eventually there will be more cases here
|
||||
// pkg/dist-src/error-request.js
|
||||
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;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-ignore
|
||||
async function wrapRequest(state, request, options) {
|
||||
const limiter = new Bottleneck();
|
||||
// @ts-ignore
|
||||
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) {
|
||||
// Returning a number instructs the limiter to retry
|
||||
// the request after that number of milliseconds have passed
|
||||
return after * state.retryAfterBaseValue;
|
||||
}
|
||||
});
|
||||
return limiter.schedule(request, options);
|
||||
}
|
||||
|
||||
const VERSION = "4.0.4";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3,
|
||||
}, octokitOptions.retry);
|
||||
if (state.enabled) {
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
// pkg/dist-src/wrap-request.js
|
||||
import Bottleneck from "bottleneck/light";
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
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 {
|
||||
retry: {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var VERSION = "5.0.2";
|
||||
function retry(octokit, octokitOptions) {
|
||||
const state = Object.assign(
|
||||
{
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1e3,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
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 };
|
||||
//# sourceMappingURL=index.js.map
|
||||
export {
|
||||
VERSION,
|
||||
retry
|
||||
};
|
||||
|
|
|
|||
8
node_modules/@octokit/plugin-retry/dist-web/index.js.map
generated
vendored
8
node_modules/@octokit/plugin-retry/dist-web/index.js.map
generated
vendored
|
|
@ -1 +1,7 @@
|
|||
{"version":3,"file":"index.js","sources":["../dist-src/error-request.js","../dist-src/wrap-request.js","../dist-src/index.js"],"sourcesContent":["// @ts-ignore\nexport async function errorRequest(octokit, state, error, options) {\n if (!error.request || !error.request.request) {\n // address https://github.com/octokit/plugin-retry.js/issues/8\n throw error;\n }\n // retry all >= 400 && not doNotRetry\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n // Maybe eventually there will be more cases here\n throw error;\n}\n","// @ts-ignore\nimport Bottleneck from \"bottleneck/light\";\n// @ts-ignore\nexport async function wrapRequest(state, request, options) {\n const limiter = new Bottleneck();\n // @ts-ignore\n limiter.on(\"failed\", function (error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n // Returning a number instructs the limiter to retry\n // the request after that number of milliseconds have passed\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(request, options);\n}\n","import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nexport const VERSION = \"4.0.4\";\nexport function retry(octokit, octokitOptions) {\n const state = Object.assign({\n enabled: true,\n retryAfterBaseValue: 1000,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3,\n }, octokitOptions.retry);\n if (state.enabled) {\n octokit.hook.error(\"request\", errorRequest.bind(null, octokit, state));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state));\n }\n return {\n retry: {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries: retries,\n retryAfter: retryAfter,\n });\n return error;\n },\n },\n };\n}\nretry.VERSION = VERSION;\n"],"names":[],"mappings":";;AAAA;AACO,eAAe,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;AACnE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AAClD;AACA,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK;AACL;AACA,IAAI,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACzE,QAAQ,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAClG,QAAQ,MAAM,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,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAC7C,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7B,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE;AACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/E,QAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACpE,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,KAAK,EAAE;AACf,YAAY,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,KAAK;AAC1D,gBAAgB,KAAK,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AACjF,oBAAoB,OAAO,EAAE,OAAO;AACpC,oBAAoB,UAAU,EAAE,UAAU;AAC1C,iBAAiB,CAAC,CAAC;AACnB,gBAAgB,OAAO,KAAK,CAAC;AAC7B,aAAa;AACb,SAAS;AACT,KAAK,CAAC;AACN,CAAC;AACD,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;;;;"}
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../dist-src/error-request.js", "../dist-src/wrap-request.js", "../dist-src/index.js"],
|
||||
"sourcesContent": ["async function errorRequest(state, octokit, error, options) {\n if (!error.request || !error.request.request) {\n throw error;\n }\n if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {\n const retries = options.request.retries != null ? options.request.retries : state.retries;\n const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);\n throw octokit.retry.retryRequest(error, retries, retryAfter);\n }\n throw error;\n}\nexport {\n errorRequest\n};\n", "import Bottleneck from \"bottleneck/light\";\nimport { RequestError } from \"@octokit/request-error\";\nimport { errorRequest } from \"./error-request\";\nasync function wrapRequest(state, octokit, request, options) {\n const limiter = new Bottleneck();\n limiter.on(\"failed\", function(error, info) {\n const maxRetries = ~~error.request.request.retries;\n const after = ~~error.request.request.retryAfter;\n options.request.retryCount = info.retryCount + 1;\n if (maxRetries > info.retryCount) {\n return after * state.retryAfterBaseValue;\n }\n });\n return limiter.schedule(\n requestWithGraphqlErrorHandling.bind(null, state, octokit, request),\n options\n );\n}\nasync function requestWithGraphqlErrorHandling(state, octokit, request, options) {\n const response = await request(request, options);\n if (response.data && response.data.errors && /Something went wrong while executing your query/.test(\n response.data.errors[0].message\n )) {\n const error = new RequestError(response.data.errors[0].message, 500, {\n request: options,\n response\n });\n return errorRequest(state, octokit, error, options);\n }\n return response;\n}\nexport {\n wrapRequest\n};\n", "import { errorRequest } from \"./error-request\";\nimport { wrapRequest } from \"./wrap-request\";\nconst VERSION = \"5.0.2\";\nfunction retry(octokit, octokitOptions) {\n const state = Object.assign(\n {\n enabled: true,\n retryAfterBaseValue: 1e3,\n doNotRetry: [400, 401, 403, 404, 422],\n retries: 3\n },\n octokitOptions.retry\n );\n if (state.enabled) {\n octokit.hook.error(\"request\", errorRequest.bind(null, state, octokit));\n octokit.hook.wrap(\"request\", wrapRequest.bind(null, state, octokit));\n }\n return {\n retry: {\n retryRequest: (error, retries, retryAfter) => {\n error.request.request = Object.assign({}, error.request.request, {\n retries,\n retryAfter\n });\n return error;\n }\n }\n };\n}\nretry.VERSION = VERSION;\nexport {\n VERSION,\n retry\n};\n"],
|
||||
"mappings": ";AAAA,eAAe,aAAa,OAAO,SAAS,OAAO,SAAS;AAC1D,MAAI,CAAC,MAAM,WAAW,CAAC,MAAM,QAAQ,SAAS;AAC5C,UAAM;AAAA,EACR;AACA,MAAI,MAAM,UAAU,OAAO,CAAC,MAAM,WAAW,SAAS,MAAM,M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AAA,MACrB,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,MACpC,SAAS;AAAA,IACX;AAAA,IACA,eAAe;AAAA,EACjB;AACA,MAAI,MAAM,SAAS;AACjB,YAAQ,KAAK,MAAM,WAAW,aAAa,KAAK,MAAM,OAAO,OAAO,CAAC;AACrE,YAAQ,KAAK,KAAK,WAAW,YAAY,KAAK,MAAM,OAAO,OAAO,CAAC;AAAA,EACrE;AACA,SAAO;AAAA,IACL,OAAO;AAAA,MACL,cAAc,CAAC,OAAO,SAAS,eAAe;AAC5C,cAAM,QAAQ,UAAU,OAAO,OAAO,CAAC,GAAG,MAAM,QAAQ,SAAS;AAAA,UAC/D;AAAA,UACA;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AACA,MAAM,UAAU;",
|
||||
"names": []
|
||||
}
|
||||
|
|
|
|||
45
node_modules/@octokit/plugin-retry/package.json
generated
vendored
45
node_modules/@octokit/plugin-retry/package.json
generated
vendored
|
|
@ -1,19 +1,13 @@
|
|||
{
|
||||
"name": "@octokit/plugin-retry",
|
||||
"version": "5.0.2",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "Automatic retry plugin for octokit",
|
||||
"version": "4.0.4",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"repository": "github:octokit/plugin-retry.js",
|
||||
"author": "Simon Grondin (http://github.com/SGrondin)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"bottleneck": "^2.15.3"
|
||||
|
|
@ -23,25 +17,30 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@octokit/core": "^4.0.0",
|
||||
"@octokit/request-error": "^3.0.0",
|
||||
"@pika/pack": "^0.3.7",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"@octokit/request-error": "^4.0.0",
|
||||
"@octokit/tsconfig": "^2.0.0",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"esbuild": "^0.17.19",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"glob": "^10.2.6",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "2.8.3",
|
||||
"prettier": "2.8.8",
|
||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^4.0.2"
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
"node": ">= 18"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"main": "dist-node/index.js",
|
||||
"browser": "dist-web/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"module": "dist-src/index.js",
|
||||
"sideEffects": false
|
||||
}
|
||||
|
|
|
|||
14
package-lock.json
generated
14
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "codeql",
|
||||
"version": "2.3.7",
|
||||
"version": "2.20.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "codeql",
|
||||
"version": "2.3.7",
|
||||
"version": "2.20.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^1.1.0",
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@chrisgavin/safe-which": "^1.0.2",
|
||||
"@octokit/plugin-retry": "^4.0.4",
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"@schemastore/package": "^0.0.6",
|
||||
"@types/uuid": "^9.0.0",
|
||||
|
|
@ -652,15 +652,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@octokit/plugin-retry": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-4.0.4.tgz",
|
||||
"integrity": "sha512-d7qGFLR3AH+WbNEDUvBPgMc7wRCxU40FZyNXFFqs8ISw75ZYS5/P3ScggzU13dCoY0aywYDxKugGstQTwNgppA==",
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-5.0.2.tgz",
|
||||
"integrity": "sha512-/Z7rWLCfjwmaVdyFuMkZoAnhfrvYgtvDrbO2d6lv7XrvJa8gFGB5tLUMngfuyMBfDCc5B9+EVu7IkQx5ebVlMg==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"bottleneck": "^2.15.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
"node": ">= 18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=3"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codeql",
|
||||
"version": "2.3.7",
|
||||
"version": "2.20.1",
|
||||
"private": true,
|
||||
"description": "CodeQL action",
|
||||
"scripts": {
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@chrisgavin/safe-which": "^1.0.2",
|
||||
"@octokit/plugin-retry": "^4.0.4",
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"@schemastore/package": "^0.0.6",
|
||||
"@types/uuid": "^9.0.0",
|
||||
|
|
|
|||
17
pr-checks/checks/resolve-environment-action.yml
Normal file
17
pr-checks/checks/resolve-environment-action.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
name: "Resolve environment"
|
||||
description: "Tests that the resolve-environment action works for Go"
|
||||
versions: ["stable-v2.13.4"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- uses: ./../action/resolve-environment
|
||||
id: resolve-environment
|
||||
with:
|
||||
language: go
|
||||
|
||||
- name: "Fail if no Go configuration was returned"
|
||||
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
|
||||
run: exit 1
|
||||
23
resolve-environment/action.yml
Normal file
23
resolve-environment/action.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
name: 'CodeQL: Resolve Build Environment'
|
||||
description: '[Experimental] Attempt to infer a build environment suitable for automatic builds'
|
||||
author: 'GitHub'
|
||||
inputs:
|
||||
token:
|
||||
default: ${{ github.token }}
|
||||
matrix:
|
||||
default: ${{ toJson(matrix) }}
|
||||
language:
|
||||
description: The language to infer the build environment configuration for.
|
||||
required: true
|
||||
working-directory:
|
||||
description: >-
|
||||
Resolve the build environment based on the files located at the specified
|
||||
path (relative to $GITHUB_WORKSPACE). If this input is not set, then the
|
||||
build environment is resolved based on the files in $GITHUB_WORKSPACE.
|
||||
required: false
|
||||
outputs:
|
||||
environment:
|
||||
description: The inferred build environment configuration.
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: '../lib/resolve-environment-action.js'
|
||||
|
|
@ -306,7 +306,8 @@ type ActionName =
|
|||
| "autobuild"
|
||||
| "finish"
|
||||
| "upload-sarif"
|
||||
| "init-post";
|
||||
| "init-post"
|
||||
| "resolve-environment";
|
||||
export type ActionStatus =
|
||||
| "starting"
|
||||
| "aborted"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"maximumVersion": "3.10", "minimumVersion": "3.6"}
|
||||
{"maximumVersion": "3.10", "minimumVersion": "3.5"}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,13 @@ export interface CodeQL {
|
|||
queries: string[],
|
||||
extraSearchPath: string | undefined
|
||||
): Promise<ResolveQueriesOutput>;
|
||||
/**
|
||||
* Run 'codeql resolve build-environment'
|
||||
*/
|
||||
resolveBuildEnvironment(
|
||||
workingDir: string | undefined,
|
||||
language: Language
|
||||
): Promise<ResolveBuildEnvironmentOutput>;
|
||||
|
||||
/**
|
||||
* Run 'codeql pack download'.
|
||||
|
|
@ -229,6 +236,14 @@ export interface ResolveQueriesOutput {
|
|||
};
|
||||
}
|
||||
|
||||
export interface ResolveBuildEnvironmentOutput {
|
||||
configuration?: {
|
||||
[language: string]: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface PackDownloadOutput {
|
||||
packs: PackDownloadItem[];
|
||||
}
|
||||
|
|
@ -289,6 +304,11 @@ export const CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
|
|||
*/
|
||||
export const CODEQL_VERSION_INIT_WITH_QLCONFIG = "2.12.4";
|
||||
|
||||
/**
|
||||
* Versions 2.13.4+ of the CodeQL CLI support the `resolve build-environment` command.
|
||||
*/
|
||||
export const CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
|
||||
|
||||
/**
|
||||
* Set up CodeQL CLI access.
|
||||
*
|
||||
|
|
@ -402,6 +422,10 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
|||
"betterResolveLanguages"
|
||||
),
|
||||
resolveQueries: resolveFunction(partialCodeql, "resolveQueries"),
|
||||
resolveBuildEnvironment: resolveFunction(
|
||||
partialCodeql,
|
||||
"resolveBuildEnvironment"
|
||||
),
|
||||
packDownload: resolveFunction(partialCodeql, "packDownload"),
|
||||
databaseCleanup: resolveFunction(partialCodeql, "databaseCleanup"),
|
||||
databaseBundle: resolveFunction(partialCodeql, "databaseBundle"),
|
||||
|
|
@ -681,6 +705,29 @@ export async function getCodeQLForCmd(
|
|||
throw new Error(`Unexpected output from codeql resolve queries: ${e}`);
|
||||
}
|
||||
},
|
||||
async resolveBuildEnvironment(
|
||||
workingDir: string | undefined,
|
||||
language: Language
|
||||
) {
|
||||
const codeqlArgs = [
|
||||
"resolve",
|
||||
"build-environment",
|
||||
`--language=${language}`,
|
||||
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
|
||||
];
|
||||
if (workingDir !== undefined) {
|
||||
codeqlArgs.push("--working-dir", workingDir);
|
||||
}
|
||||
const output = await runTool(cmd, codeqlArgs);
|
||||
|
||||
try {
|
||||
return JSON.parse(output);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`Unexpected output from codeql resolve build-environment: ${e} in\n${output}`
|
||||
);
|
||||
}
|
||||
},
|
||||
async databaseRunQueries(
|
||||
databasePath: string,
|
||||
extraSearchPath: string | undefined,
|
||||
|
|
|
|||
98
src/resolve-environment-action.ts
Normal file
98
src/resolve-environment-action.ts
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import {
|
||||
createStatusReportBase,
|
||||
getActionsStatus,
|
||||
getOptionalInput,
|
||||
getRequiredInput,
|
||||
getTemporaryDirectory,
|
||||
sendStatusReport,
|
||||
} from "./actions-util";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import { CommandInvocationError } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { Language, resolveAlias } from "./languages";
|
||||
import { getActionsLogger } from "./logging";
|
||||
import { runResolveBuildEnvironment } from "./resolve-environment";
|
||||
import { checkForTimeout, checkGitHubVersionInRange, wrapError } from "./util";
|
||||
|
||||
const ACTION_NAME = "resolve-environment";
|
||||
const ENVIRONMENT_OUTPUT_NAME = "environment";
|
||||
|
||||
async function run() {
|
||||
const startedAt = new Date();
|
||||
const logger = getActionsLogger();
|
||||
const language: Language = resolveAlias(getRequiredInput("language"));
|
||||
|
||||
try {
|
||||
if (
|
||||
!(await sendStatusReport(
|
||||
await createStatusReportBase(ACTION_NAME, "starting", startedAt)
|
||||
))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
|
||||
const config = await configUtils.getConfig(getTemporaryDirectory(), logger);
|
||||
if (config === undefined) {
|
||||
throw new Error(
|
||||
"Config file could not be found at expected location. Has the 'init' action been called?"
|
||||
);
|
||||
}
|
||||
|
||||
const workingDirectory = getOptionalInput("working-directory");
|
||||
const result = await runResolveBuildEnvironment(
|
||||
config.codeQLCmd,
|
||||
logger,
|
||||
workingDirectory,
|
||||
language
|
||||
);
|
||||
core.setOutput(ENVIRONMENT_OUTPUT_NAME, result);
|
||||
} catch (unwrappedError) {
|
||||
const error = wrapError(unwrappedError);
|
||||
|
||||
if (error instanceof CommandInvocationError) {
|
||||
// If the CLI failed to run successfully for whatever reason,
|
||||
// we just return an empty JSON object and proceed with the workflow.
|
||||
core.setOutput(ENVIRONMENT_OUTPUT_NAME, {});
|
||||
logger.warning(
|
||||
`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`
|
||||
);
|
||||
} else {
|
||||
// For any other error types, something has more seriously gone wrong and we fail.
|
||||
core.setFailed(
|
||||
`Failed to resolve a build environment suitable for automatically building your code. ${error.message}`
|
||||
);
|
||||
|
||||
await sendStatusReport(
|
||||
await createStatusReportBase(
|
||||
ACTION_NAME,
|
||||
getActionsStatus(error),
|
||||
startedAt,
|
||||
error.message,
|
||||
error.stack
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await sendStatusReport(
|
||||
await createStatusReportBase(ACTION_NAME, "success", startedAt)
|
||||
);
|
||||
}
|
||||
|
||||
async function runWrapper() {
|
||||
try {
|
||||
await run();
|
||||
} catch (error) {
|
||||
core.setFailed(`${ACTION_NAME} action failed: ${wrapError(error).message}`);
|
||||
}
|
||||
await checkForTimeout();
|
||||
}
|
||||
|
||||
void runWrapper();
|
||||
36
src/resolve-environment.ts
Normal file
36
src/resolve-environment.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { CODEQL_VERSION_RESOLVE_ENVIRONMENT, getCodeQL } from "./codeql";
|
||||
import { Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import * as util from "./util";
|
||||
|
||||
export async function runResolveBuildEnvironment(
|
||||
cmd: string,
|
||||
logger: Logger,
|
||||
workingDir: string | undefined,
|
||||
language: Language
|
||||
) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${language}`);
|
||||
|
||||
const codeql = await getCodeQL(cmd);
|
||||
let result = {};
|
||||
|
||||
// If the CodeQL version in use does not support the `resolve build-environment`
|
||||
// command, just return an empty configuration. Otherwise invoke the CLI.
|
||||
if (
|
||||
!(await util.codeQlVersionAbove(codeql, CODEQL_VERSION_RESOLVE_ENVIRONMENT))
|
||||
) {
|
||||
logger.warning(
|
||||
"Unsupported CodeQL CLI version for `resolve build-environment` command, " +
|
||||
"returning an empty configuration."
|
||||
);
|
||||
} else {
|
||||
if (workingDir !== undefined) {
|
||||
logger.info(`Using ${workingDir} as the working directory.`);
|
||||
}
|
||||
|
||||
result = await codeql.resolveBuildEnvironment(workingDir, language);
|
||||
}
|
||||
|
||||
logger.endGroup();
|
||||
return result;
|
||||
}
|
||||
|
|
@ -506,18 +506,23 @@ function handleProcessingResultForUnsuccessfulExecution(
|
|||
) {
|
||||
logger.debug(
|
||||
"Successfully uploaded a SARIF file for the unsuccessful execution. Received expected " +
|
||||
'"unsuccessful execution" error, and no other errors.'
|
||||
'"unsuccessful execution" processing error, and no other errors.'
|
||||
);
|
||||
} else if (status === "failed") {
|
||||
logger.warning(
|
||||
`Failed to upload a SARIF file for the unsuccessful execution. Code scanning status ` +
|
||||
`information for the repository may be out of date as a result. Processing errors: ${response.data.errors}`
|
||||
);
|
||||
} else if (status === "complete") {
|
||||
// There is a known transient issue with the code scanning API where it sometimes reports
|
||||
// `complete` for an unsuccessful execution submission.
|
||||
logger.debug(
|
||||
"Uploaded a SARIF file for the unsuccessful execution, but did not receive the expected " +
|
||||
'"unsuccessful execution" processing error. This is a known transient issue with the ' +
|
||||
"code scanning API, and does not cause out of date code scanning status information."
|
||||
);
|
||||
} else {
|
||||
const shortMessage =
|
||||
"Failed to upload a SARIF file for the unsuccessful execution. Code scanning status " +
|
||||
"information for the repository may be out of date as a result.";
|
||||
const longMessage =
|
||||
shortMessage + status === "failed"
|
||||
? ` Processing errors: ${response.data.errors}`
|
||||
: ' Encountered no processing errors, but expected to receive an "unsuccessful execution" error.';
|
||||
logger.debug(longMessage);
|
||||
throw new Error(shortMessage);
|
||||
util.assertNever(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue