mirror of
https://github.com/github/codeql-action.git
synced 2026-08-05 13:02:04 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c916bca591 | |||
| 1cfa3fccb6 |
@@ -2,11 +2,9 @@ name: "Prepare test"
|
|||||||
description: Performs some preparation to run tests
|
description: Performs some preparation to run tests
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: "The version of the CodeQL CLI to use. Can be 'latest', 'cached', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
|
|
||||||
required: true
|
required: true
|
||||||
outputs:
|
outputs:
|
||||||
tools-url:
|
tools-url:
|
||||||
description: "The value that should be passed as the 'tools' input of the 'init' step."
|
|
||||||
value: ${{ steps.get-url.outputs.tools-url }}
|
value: ${{ steps.get-url.outputs.tools-url }}
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -22,7 +20,6 @@ runs:
|
|||||||
name: Determine URL
|
name: Determine URL
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e # Fail this Action if `gh release list` fails.
|
|
||||||
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
||||||
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
||||||
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
||||||
@@ -37,6 +34,5 @@ runs:
|
|||||||
elif [[ ${{ inputs.version }} == "cached" ]]; then
|
elif [[ ${{ inputs.version }} == "cached" ]]; then
|
||||||
echo "tools-url=" >> $GITHUB_OUTPUT
|
echo "tools-url=" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "::error::Unrecognized version specified!"
|
echo "::error Unrecognized version specified!"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ def update_changelog(version):
|
|||||||
else:
|
else:
|
||||||
content = EMPTY_CHANGELOG
|
content = EMPTY_CHANGELOG
|
||||||
|
|
||||||
newContent = content.replace('[UNRELEASED]', f'{version} - {get_today_string()}', 1)
|
newContent = content.replace('[UNRELEASED]', f'${version} - {get_today_string()}', 1)
|
||||||
|
|
||||||
with open('CHANGELOG.md', 'w') as f:
|
with open('CHANGELOG.md', 'w') as f:
|
||||||
f.write(newContent)
|
f.write(newContent)
|
||||||
|
|||||||
Generated
-1
@@ -54,7 +54,6 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: pwd
|
run: pwd
|
||||||
- uses: ./../action/autobuild
|
- uses: ./../action/autobuild
|
||||||
timeout-minutes: 10
|
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
id: analysis
|
id: analysis
|
||||||
- name: Check database
|
- name: Check database
|
||||||
|
|||||||
@@ -1,23 +1,6 @@
|
|||||||
name: Test Python Package Installation
|
name: Test Python Package Installation on Linux and Mac
|
||||||
|
|
||||||
on:
|
on: push
|
||||||
push:
|
|
||||||
branches: [main, releases/v2]
|
|
||||||
pull_request:
|
|
||||||
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
|
|
||||||
# by other workflows.
|
|
||||||
types: [opened, synchronize, reopened, ready_for_review]
|
|
||||||
paths:
|
|
||||||
# Changes to this workflow.
|
|
||||||
- '.github/workflows/python-deps.yml'
|
|
||||||
# Changes to the Python package installation scripts and their tests.
|
|
||||||
- 'python-setup/**'
|
|
||||||
# Changes to the default CodeQL bundle version.
|
|
||||||
- '**/defaults.json'
|
|
||||||
schedule:
|
|
||||||
# Weekly on Monday.
|
|
||||||
- cron: '0 0 * * 1'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-setup-python-scripts:
|
test-setup-python-scripts:
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ if [ ! -z "$(git status --porcelain)" ]; then
|
|||||||
>&2 echo "Failed: Repo should be clean before testing!"
|
>&2 echo "Failed: Repo should be clean before testing!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# Pin npm to v8 since v9 doesn't support Node 12.
|
||||||
# When updating this, make sure to update the npm version in
|
# When updating this, make sure to update the npm version in
|
||||||
# `.github/workflows/update-dependencies.yml` too.
|
# `.github/workflows/update-dependencies.yml` too.
|
||||||
sudo npm install --force -g npm@9.2.0
|
sudo npm install --force -g npm@^8.19.3
|
||||||
# Reinstall modules and then clean to remove absolute paths
|
# Reinstall modules and then clean to remove absolute paths
|
||||||
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
|
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
|
||||||
npm ci
|
npm ci
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git fetch origin "$BRANCH" --depth=1
|
git fetch origin "$BRANCH" --depth=1
|
||||||
git checkout "origin/$BRANCH"
|
git checkout "origin/$BRANCH"
|
||||||
|
# Pin npm to v8 since v9 doesn't support Node 12.
|
||||||
# When updating this, make sure to update the npm version in
|
# When updating this, make sure to update the npm version in
|
||||||
# `.github/workflows/script/check-node-modules.sh` too.
|
# `.github/workflows/script/check-node-modules.sh` too.
|
||||||
sudo npm install --force -g npm@9.2.0
|
sudo npm install --force -g npm@^8.19.3
|
||||||
npm install
|
npm install
|
||||||
npm ci
|
npm ci
|
||||||
npm run removeNPMAbsolutePaths
|
npm run removeNPMAbsolutePaths
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,6 @@
|
|||||||
# CodeQL Action Changelog
|
# CodeQL Action Changelog
|
||||||
|
|
||||||
## 2.2.0 - 26 Jan 2023
|
## [UNRELEASED]
|
||||||
|
|
||||||
- Improve stability when choosing the default version of CodeQL to use in code scanning workflow runs on Actions on GitHub.com. [#1475](https://github.com/github/codeql-action/pull/1475)
|
- Improve stability when choosing the default version of CodeQL to use in code scanning workflow runs on Actions on GitHub.com. [#1475](https://github.com/github/codeql-action/pull/1475)
|
||||||
- This change addresses customer reports of code scanning alerts on GitHub.com being closed and reopened during the rollout of new versions of CodeQL in the GitHub Actions [runner images](https://github.com/actions/runner-images).
|
- This change addresses customer reports of code scanning alerts on GitHub.com being closed and reopened during the rollout of new versions of CodeQL in the GitHub Actions [runner images](https://github.com/actions/runner-images).
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
- These changes will not affect the majority of code scanning workflows. Continue reading only if your workflow uses [@actions/tool-cache](https://github.com/actions/toolkit/tree/main/packages/tool-cache) or relies on the precise location of CodeQL within the Actions tool cache.
|
- These changes will not affect the majority of code scanning workflows. Continue reading only if your workflow uses [@actions/tool-cache](https://github.com/actions/toolkit/tree/main/packages/tool-cache) or relies on the precise location of CodeQL within the Actions tool cache.
|
||||||
- The tool cache now contains **two** recent CodeQL versions (previously **one**).
|
- The tool cache now contains **two** recent CodeQL versions (previously **one**).
|
||||||
- Each CodeQL version is located under a directory named after the release date and version number, e.g. CodeQL 2.11.6 is now located under `CodeQL/2.11.6-20221211/x64/codeql` (previously `CodeQL/0.0.0-20221211/x64/codeql`).
|
- Each CodeQL version is located under a directory named after the release date and version number, e.g. CodeQL 2.11.6 is now located under `CodeQL/2.11.6-20221211/x64/codeql` (previously `CodeQL/0.0.0-20221211/x64/codeql`).
|
||||||
- The maximum number of [SARIF runs](https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning#run-object) per file has been increased from 15 to 20 for users uploading SARIF files to GitHub.com. This change will help ensure that Code Scanning can process SARIF files generated by third-party tools that have many runs. See the [GitHub API documentation](https://docs.github.com/en/rest/code-scanning#upload-an-analysis-as-sarif-data) for a list of all the limits around uploading SARIF. This change will be released to GitHub Enterprise Server as part of GHES 3.9.
|
|
||||||
- Update default CodeQL bundle version to 2.12.1. [#1498](https://github.com/github/codeql-action/pull/1498)
|
- Update default CodeQL bundle version to 2.12.1. [#1498](https://github.com/github/codeql-action/pull/1498)
|
||||||
- Fix a bug that forced the `init` Action to run for at least two minutes on JavaScript. [#1494](https://github.com/github/codeql-action/pull/1494)
|
- Fix a bug that forced the `init` Action to run for at least two minutes on JavaScript. [#1494](https://github.com/github/codeql-action/pull/1494)
|
||||||
|
|
||||||
|
|||||||
Generated
+1
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.runPromise = exports.sendStatusReport = void 0;
|
exports.runPromise = exports.sendStatusReport = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path_1 = __importDefault(require("path"));
|
const path_1 = __importDefault(require("path"));
|
||||||
|
// We need to import `performance` on Node 12
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
const perf_hooks_1 = require("perf_hooks");
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+1
-1
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.validateQueryFilters = exports.runCleanup = exports.runFinalize = exports.createQuerySuiteContents = exports.convertPackToQuerySuiteEntry = exports.runQueries = exports.dbIsFinalized = exports.createdDBForScannedLanguages = exports.CodeQLAnalysisError = void 0;
|
exports.validateQueryFilters = exports.runCleanup = exports.runFinalize = exports.createQuerySuiteContents = exports.convertPackToQuerySuiteEntry = exports.runQueries = exports.dbIsFinalized = exports.createdDBForScannedLanguages = exports.CodeQLAnalysisError = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
const perf_hooks_1 = require("perf_hooks"); // We need to import `performance` on Node 12
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
const del_1 = __importDefault(require("del"));
|
const del_1 = __importDefault(require("del"));
|
||||||
const yaml = __importStar(require("js-yaml"));
|
const yaml = __importStar(require("js-yaml"));
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+2
-7
@@ -110,7 +110,7 @@ exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
|
|||||||
*/
|
*/
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const { codeqlFolder, toolsDownloadDurationMs, toolsSource, toolsVersion } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger);
|
const { codeqlFolder, toolsVersion } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger);
|
||||||
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
|
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
codeqlCmd += ".exe";
|
codeqlCmd += ".exe";
|
||||||
@@ -119,12 +119,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, bypassToolc
|
|||||||
throw new Error(`Unsupported platform: ${process.platform}`);
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||||
}
|
}
|
||||||
cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
|
cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
|
||||||
return {
|
return { codeql: cachedCodeQL, toolsVersion };
|
||||||
codeql: cachedCodeQL,
|
|
||||||
toolsDownloadDurationMs,
|
|
||||||
toolsSource,
|
|
||||||
toolsVersion,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.error(e instanceof Error ? e : new Error(String(e)));
|
logger.error(e instanceof Error ? e : new Error(String(e)));
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+36
-43
@@ -42,7 +42,6 @@ const api = __importStar(require("./api-client"));
|
|||||||
const codeql = __importStar(require("./codeql"));
|
const codeql = __importStar(require("./codeql"));
|
||||||
const defaults = __importStar(require("./defaults.json"));
|
const defaults = __importStar(require("./defaults.json"));
|
||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const init_1 = require("./init");
|
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
@@ -156,8 +155,6 @@ function mockApiDetails(apiDetails) {
|
|||||||
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||||
t.is(result.toolsVersion, `0.0.0-${version}`);
|
t.is(result.toolsVersion, `0.0.0-${version}`);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
|
||||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
|
||||||
}
|
}
|
||||||
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
t.is(toolcache.findAllVersions("CodeQL").length, 2);
|
||||||
});
|
});
|
||||||
@@ -176,8 +173,6 @@ function mockApiDetails(apiDetails) {
|
|||||||
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||||
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
|
||||||
t.not(result.toolsDownloadDurationMs, undefined);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES = [
|
const EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES = [
|
||||||
@@ -211,55 +206,61 @@ for (const { cliVersion, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUN
|
|||||||
t.assert(releaseApiMock.isDone(), "Releases API should have been called");
|
t.assert(releaseApiMock.isDone(), "Releases API should have been called");
|
||||||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||||
t.deepEqual(result.toolsVersion, cliVersion);
|
t.deepEqual(result.toolsVersion, cliVersion);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
|
||||||
t.not(result.toolsDownloadDurationMs, undefined);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const { githubReleases, toolcacheVersion } of [
|
for (const { isCached, tagName, toolcacheCliVersion } of [
|
||||||
// Test that we use the tools from the toolcache when `SAMPLE_DEFAULT_CLI_VERSION` is requested
|
|
||||||
// and `SAMPLE_DEFAULT_CLI_VERSION-` is in the toolcache.
|
|
||||||
{
|
{
|
||||||
toolcacheVersion: SAMPLE_DEFAULT_CLI_VERSION.cliVersion,
|
isCached: true,
|
||||||
|
tagName: "codeql-bundle-20230101",
|
||||||
|
toolcacheCliVersion: SAMPLE_DEFAULT_CLI_VERSION.cliVersion,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
githubReleases: {
|
isCached: true,
|
||||||
"codeql-bundle-20230101": `cli-version-${SAMPLE_DEFAULT_CLI_VERSION.cliVersion}.txt`,
|
// By leaving toolcacheCliVersion undefined, the bundle will be installed
|
||||||
},
|
// into the toolcache as `${SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`.
|
||||||
toolcacheVersion: "0.0.0-20230101",
|
// This lets us test that `x.y.z-yyyymmdd` toolcache versions are used if an
|
||||||
|
// `x.y.z` version isn't in the toolcache.
|
||||||
|
tagName: `codeql-bundle-${SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
toolcacheVersion: `${SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`,
|
isCached: false,
|
||||||
|
tagName: "codeql-bundle-20230101",
|
||||||
},
|
},
|
||||||
]) {
|
]) {
|
||||||
(0, ava_1.default)(`uses tools from toolcache when ${SAMPLE_DEFAULT_CLI_VERSION.cliVersion} is requested and ` +
|
(0, ava_1.default)(`uses default version on Dotcom when default version bundle ${tagName} is ${isCached ? "" : "not "}cached`, async (t) => {
|
||||||
`${toolcacheVersion} is installed`, async (t) => {
|
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
sinon
|
if (isCached) {
|
||||||
.stub(toolcache, "find")
|
await installIntoToolcache({
|
||||||
.withArgs("CodeQL", toolcacheVersion)
|
cliVersion: toolcacheCliVersion,
|
||||||
.returns("path/to/cached/codeql");
|
tagName,
|
||||||
sinon.stub(toolcache, "findAllVersions").returns([toolcacheVersion]);
|
isPinned: true,
|
||||||
if (githubReleases) {
|
tmpDir,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mockDownloadApi({
|
||||||
|
tagName,
|
||||||
|
});
|
||||||
sinon.stub(api, "getApiClient").value(() => ({
|
sinon.stub(api, "getApiClient").value(() => ({
|
||||||
repos: {
|
repos: {
|
||||||
listReleases: sinon.stub().resolves(undefined),
|
listReleases: sinon.stub().resolves(undefined),
|
||||||
},
|
},
|
||||||
paginate: sinon.stub().resolves(Object.entries(githubReleases).map(([releaseTagName, cliVersionMarkerFile]) => ({
|
paginate: sinon.stub().resolves([
|
||||||
assets: [
|
{
|
||||||
{
|
assets: [
|
||||||
name: cliVersionMarkerFile,
|
{
|
||||||
},
|
name: "cli-version-2.0.0.txt",
|
||||||
],
|
},
|
||||||
tag_name: releaseTagName,
|
],
|
||||||
}))),
|
tag_name: tagName,
|
||||||
|
},
|
||||||
|
]),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
const result = await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Toolcache);
|
|
||||||
t.is(result.toolsDownloadDurationMs, undefined);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -278,8 +279,6 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
variant,
|
variant,
|
||||||
}, (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
|
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Toolcache);
|
|
||||||
t.is(result.toolsDownloadDurationMs, undefined);
|
|
||||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
t.is(cachedVersions.length, 1);
|
t.is(cachedVersions.length, 1);
|
||||||
});
|
});
|
||||||
@@ -301,8 +300,6 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
variant,
|
variant,
|
||||||
}, (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
|
||||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
|
||||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
t.is(cachedVersions.length, 2);
|
t.is(cachedVersions.length, 2);
|
||||||
});
|
});
|
||||||
@@ -321,8 +318,6 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, false, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
|
||||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
|
||||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
t.is(cachedVersions.length, 2);
|
t.is(cachedVersions.length, 2);
|
||||||
});
|
});
|
||||||
@@ -353,13 +348,11 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
mockApiDetails(sampleGHAEApiDetails);
|
mockApiDetails(sampleGHAEApiDetails);
|
||||||
sinon.stub(actionsUtil, "isRunningLocalAction").returns(false);
|
sinon.stub(actionsUtil, "isRunningLocalAction").returns(false);
|
||||||
process.env["GITHUB_ACTION_REPOSITORY"] = "github/codeql-action";
|
process.env["GITHUB_ACTION_REPOSITORY"] = "github/codeql-action";
|
||||||
const result = await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, util.GitHubVariant.GHAE, false, {
|
await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, util.GitHubVariant.GHAE, false, {
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
variant: util.GitHubVariant.GHAE,
|
variant: util.GitHubVariant.GHAE,
|
||||||
}, (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
|
||||||
t.is(typeof result.toolsDownloadDurationMs, "number");
|
|
||||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||||
t.is(cachedVersions.length, 1);
|
t.is(cachedVersions.length, 1);
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+1
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.prettyPrintPack = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
|
exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.prettyPrintPack = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
// We need to import `performance` on Node 12
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
const perf_hooks_1 = require("perf_hooks");
|
||||||
const yaml = __importStar(require("js-yaml"));
|
const yaml = __importStar(require("js-yaml"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+6
-20
@@ -32,6 +32,7 @@ const defaults = __importStar(require("./defaults.json"));
|
|||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_";
|
const DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_";
|
||||||
const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
|
const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
|
||||||
|
const MINIMUM_ENABLED_CODEQL_VERSION = "2.11.6";
|
||||||
var Feature;
|
var Feature;
|
||||||
(function (Feature) {
|
(function (Feature) {
|
||||||
Feature["BypassToolcacheEnabled"] = "bypass_toolcache_enabled";
|
Feature["BypassToolcacheEnabled"] = "bypass_toolcache_enabled";
|
||||||
@@ -154,10 +155,8 @@ class GitHubFeatureFlags {
|
|||||||
}
|
}
|
||||||
async getDefaultCliVersion(variant) {
|
async getDefaultCliVersion(variant) {
|
||||||
if (variant === util.GitHubVariant.DOTCOM) {
|
if (variant === util.GitHubVariant.DOTCOM) {
|
||||||
const defaultDotComCliVersion = await this.getDefaultDotcomCliVersion();
|
|
||||||
return {
|
return {
|
||||||
cliVersion: defaultDotComCliVersion.version,
|
cliVersion: await this.getDefaultDotcomCliVersion(),
|
||||||
toolsFeatureFlagsValid: defaultDotComCliVersion.toolsFeatureFlagsValid,
|
|
||||||
variant,
|
variant,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -174,26 +173,13 @@ class GitHubFeatureFlags {
|
|||||||
.filter((f) => f !== undefined)
|
.filter((f) => f !== undefined)
|
||||||
.map((f) => f);
|
.map((f) => f);
|
||||||
if (enabledFeatureFlagCliVersions.length === 0) {
|
if (enabledFeatureFlagCliVersions.length === 0) {
|
||||||
// We expect at least one default CLI version to be enabled on Dotcom at any time. However if
|
this.logger.debug("Feature flags do not specify a default CLI version. Falling back to CLI version " +
|
||||||
// the feature flags are misconfigured, rather than crashing, we fall back to the CLI version
|
`${MINIMUM_ENABLED_CODEQL_VERSION}.`);
|
||||||
// shipped with the Action in defaults.json. This has the effect of immediately rolling out
|
return MINIMUM_ENABLED_CODEQL_VERSION;
|
||||||
// new CLI versions to all users running the latest Action.
|
|
||||||
//
|
|
||||||
// A drawback of this approach relates to the small number of users that run old versions of
|
|
||||||
// the Action on Dotcom. As a result of this approach, if we misconfigure the feature flags
|
|
||||||
// then these users will experience some alert churn. This is because the CLI version in the
|
|
||||||
// defaults.json shipped with an old version of the Action is likely older than the CLI
|
|
||||||
// version that would have been specified by the feature flags before they were misconfigured.
|
|
||||||
this.logger.warning("Feature flags do not specify a default CLI version. Falling back to the CLI version " +
|
|
||||||
`shipped with the Action. This is ${defaults.cliVersion}.`);
|
|
||||||
return {
|
|
||||||
version: defaults.cliVersion,
|
|
||||||
toolsFeatureFlagsValid: false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
const maxCliVersion = enabledFeatureFlagCliVersions.reduce((maxVersion, currentVersion) => currentVersion > maxVersion ? currentVersion : maxVersion, enabledFeatureFlagCliVersions[0]);
|
const maxCliVersion = enabledFeatureFlagCliVersions.reduce((maxVersion, currentVersion) => currentVersion > maxVersion ? currentVersion : maxVersion, enabledFeatureFlagCliVersions[0]);
|
||||||
this.logger.debug(`Derived default CLI version of ${maxCliVersion} from feature flags.`);
|
this.logger.debug(`Derived default CLI version of ${maxCliVersion} from feature flags.`);
|
||||||
return { version: maxCliVersion, toolsFeatureFlagsValid: true };
|
return maxCliVersion;
|
||||||
}
|
}
|
||||||
async getValue(feature) {
|
async getValue(feature) {
|
||||||
const response = await this.getAllFeatures();
|
const response = await this.getAllFeatures();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+6
-13
@@ -217,8 +217,7 @@ for (const variant of [util_1.GitHubVariant.GHAE, util_1.GitHubVariant.GHES]) {
|
|||||||
(0, ava_1.default)(`selects CLI from defaults.json on ${util_1.GitHubVariant[variant]}`, async (t) => {
|
(0, ava_1.default)(`selects CLI from defaults.json on ${util_1.GitHubVariant[variant]}`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const features = setUpFeatureFlagTests(tmpDir);
|
const features = setUpFeatureFlagTests(tmpDir);
|
||||||
const defaultCliVersion = await features.getDefaultCliVersion(variant);
|
t.deepEqual(await features.getDefaultCliVersion(variant), {
|
||||||
t.deepEqual(defaultCliVersion, {
|
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
variant,
|
variant,
|
||||||
@@ -237,23 +236,19 @@ for (const variant of [util_1.GitHubVariant.GHAE, util_1.GitHubVariant.GHES]) {
|
|||||||
expectedFeatureEnablement["default_codeql_version_2_12_4_enabled"] = false;
|
expectedFeatureEnablement["default_codeql_version_2_12_4_enabled"] = false;
|
||||||
expectedFeatureEnablement["default_codeql_version_2_12_5_enabled"] = false;
|
expectedFeatureEnablement["default_codeql_version_2_12_5_enabled"] = false;
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
const defaultCliVersion = await featureEnablement.getDefaultCliVersion(util_1.GitHubVariant.DOTCOM);
|
t.deepEqual(await featureEnablement.getDefaultCliVersion(util_1.GitHubVariant.DOTCOM), {
|
||||||
t.deepEqual(defaultCliVersion, {
|
|
||||||
cliVersion: "2.12.1",
|
cliVersion: "2.12.1",
|
||||||
toolsFeatureFlagsValid: true,
|
|
||||||
variant: util_1.GitHubVariant.DOTCOM,
|
variant: util_1.GitHubVariant.DOTCOM,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)(`selects CLI from defaults.json on Dotcom when no default version feature flags are enabled`, async (t) => {
|
(0, ava_1.default)(`selects CLI v2.11.6 on Dotcom when no default version feature flags are enabled`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
||||||
const expectedFeatureEnablement = initializeFeatures(true);
|
const expectedFeatureEnablement = initializeFeatures(true);
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
const defaultCliVersion = await featureEnablement.getDefaultCliVersion(util_1.GitHubVariant.DOTCOM);
|
t.deepEqual(await featureEnablement.getDefaultCliVersion(util_1.GitHubVariant.DOTCOM), {
|
||||||
t.deepEqual(defaultCliVersion, {
|
cliVersion: "2.11.6",
|
||||||
cliVersion: defaults.cliVersion,
|
|
||||||
toolsFeatureFlagsValid: false,
|
|
||||||
variant: util_1.GitHubVariant.DOTCOM,
|
variant: util_1.GitHubVariant.DOTCOM,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -268,10 +263,8 @@ for (const variant of [util_1.GitHubVariant.GHAE, util_1.GitHubVariant.GHES]) {
|
|||||||
expectedFeatureEnablement["default_codeql_version_2_12_invalid_enabled"] =
|
expectedFeatureEnablement["default_codeql_version_2_12_invalid_enabled"] =
|
||||||
true;
|
true;
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
const defaultCliVersion = await featureEnablement.getDefaultCliVersion(util_1.GitHubVariant.DOTCOM);
|
t.deepEqual(await featureEnablement.getDefaultCliVersion(util_1.GitHubVariant.DOTCOM), {
|
||||||
t.deepEqual(defaultCliVersion, {
|
|
||||||
cliVersion: "2.12.1",
|
cliVersion: "2.12.1",
|
||||||
toolsFeatureFlagsValid: true,
|
|
||||||
variant: util_1.GitHubVariant.DOTCOM,
|
variant: util_1.GitHubVariant.DOTCOM,
|
||||||
});
|
});
|
||||||
t.assert(loggedMessages.find((v) => v.type === "warning" &&
|
t.assert(loggedMessages.find((v) => v.type === "warning" &&
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+34
-62
@@ -36,62 +36,42 @@ const repository_1 = require("./repository");
|
|||||||
const trap_caching_1 = require("./trap-caching");
|
const trap_caching_1 = require("./trap-caching");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
const workflow_1 = require("./workflow");
|
const workflow_1 = require("./workflow");
|
||||||
async function sendInitStatusReport(actionStatus, startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger) {
|
async function sendSuccessStatusReport(startedAt, config, toolsVersion, logger) {
|
||||||
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("init", actionStatus, startedAt);
|
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("init", "success", startedAt);
|
||||||
|
const languages = config.languages.join(",");
|
||||||
const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages");
|
const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages");
|
||||||
const initStatusReport = {
|
const paths = (config.originalUserInput.paths || []).join(",");
|
||||||
|
const pathsIgnore = (config.originalUserInput["paths-ignore"] || []).join(",");
|
||||||
|
const disableDefaultQueries = config.originalUserInput["disable-default-queries"]
|
||||||
|
? languages
|
||||||
|
: "";
|
||||||
|
const queries = [];
|
||||||
|
let queriesInput = (0, actions_util_1.getOptionalInput)("queries")?.trim();
|
||||||
|
if (queriesInput === undefined || queriesInput.startsWith("+")) {
|
||||||
|
queries.push(...(config.originalUserInput.queries || []).map((q) => q.uses));
|
||||||
|
}
|
||||||
|
if (queriesInput !== undefined) {
|
||||||
|
queriesInput = queriesInput.startsWith("+")
|
||||||
|
? queriesInput.slice(1)
|
||||||
|
: queriesInput;
|
||||||
|
queries.push(...queriesInput.split(","));
|
||||||
|
}
|
||||||
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
|
disable_default_queries: disableDefaultQueries,
|
||||||
|
languages,
|
||||||
|
ml_powered_javascript_queries: (0, util_1.getMlPoweredJsQueriesStatus)(config),
|
||||||
|
paths,
|
||||||
|
paths_ignore: pathsIgnore,
|
||||||
|
queries: queries.join(","),
|
||||||
tools_input: (0, actions_util_1.getOptionalInput)("tools") || "",
|
tools_input: (0, actions_util_1.getOptionalInput)("tools") || "",
|
||||||
tools_resolved_version: toolsVersion,
|
tools_resolved_version: toolsVersion,
|
||||||
tools_source: toolsSource || init_1.ToolsSource.Unknown,
|
|
||||||
workflow_languages: workflowLanguages || "",
|
workflow_languages: workflowLanguages || "",
|
||||||
|
trap_cache_languages: Object.keys(config.trapCaches).join(","),
|
||||||
|
trap_cache_download_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
|
||||||
|
trap_cache_download_duration_ms: Math.round(config.trapCacheDownloadTime),
|
||||||
};
|
};
|
||||||
let initToolsDownloadFields = {};
|
await (0, actions_util_1.sendStatusReport)(statusReport);
|
||||||
if (toolsSource === init_1.ToolsSource.Download) {
|
|
||||||
initToolsDownloadFields = {
|
|
||||||
tools_download_duration_ms: toolsDownloadDurationMs,
|
|
||||||
tools_feature_flags_valid: toolsFeatureFlagsValid,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (config !== undefined) {
|
|
||||||
const languages = config.languages.join(",");
|
|
||||||
const paths = (config.originalUserInput.paths || []).join(",");
|
|
||||||
const pathsIgnore = (config.originalUserInput["paths-ignore"] || []).join(",");
|
|
||||||
const disableDefaultQueries = config.originalUserInput["disable-default-queries"]
|
|
||||||
? languages
|
|
||||||
: "";
|
|
||||||
const queries = [];
|
|
||||||
let queriesInput = (0, actions_util_1.getOptionalInput)("queries")?.trim();
|
|
||||||
if (queriesInput === undefined || queriesInput.startsWith("+")) {
|
|
||||||
queries.push(...(config.originalUserInput.queries || []).map((q) => q.uses));
|
|
||||||
}
|
|
||||||
if (queriesInput !== undefined) {
|
|
||||||
queriesInput = queriesInput.startsWith("+")
|
|
||||||
? queriesInput.slice(1)
|
|
||||||
: queriesInput;
|
|
||||||
queries.push(...queriesInput.split(","));
|
|
||||||
}
|
|
||||||
// Append fields that are dependent on `config`
|
|
||||||
const initWithConfigStatusReport = {
|
|
||||||
...initStatusReport,
|
|
||||||
disable_default_queries: disableDefaultQueries,
|
|
||||||
languages,
|
|
||||||
ml_powered_javascript_queries: (0, util_1.getMlPoweredJsQueriesStatus)(config),
|
|
||||||
paths,
|
|
||||||
paths_ignore: pathsIgnore,
|
|
||||||
queries: queries.join(","),
|
|
||||||
trap_cache_languages: Object.keys(config.trapCaches).join(","),
|
|
||||||
trap_cache_download_size_bytes: Math.round(await (0, trap_caching_1.getTotalCacheSize)(config.trapCaches, logger)),
|
|
||||||
trap_cache_download_duration_ms: Math.round(config.trapCacheDownloadTime),
|
|
||||||
};
|
|
||||||
await (0, actions_util_1.sendStatusReport)({
|
|
||||||
...initWithConfigStatusReport,
|
|
||||||
...initToolsDownloadFields,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await (0, actions_util_1.sendStatusReport)({ ...initStatusReport, ...initToolsDownloadFields });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
@@ -99,9 +79,6 @@ async function run() {
|
|||||||
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
|
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
|
||||||
let config;
|
let config;
|
||||||
let codeql;
|
let codeql;
|
||||||
let toolsDownloadDurationMs;
|
|
||||||
let toolsFeatureFlagsValid;
|
|
||||||
let toolsSource;
|
|
||||||
let toolsVersion;
|
let toolsVersion;
|
||||||
const apiDetails = {
|
const apiDetails = {
|
||||||
auth: (0, actions_util_1.getRequiredInput)("token"),
|
auth: (0, actions_util_1.getRequiredInput)("token"),
|
||||||
@@ -118,15 +95,10 @@ async function run() {
|
|||||||
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "starting", startedAt, workflowErrors)))) {
|
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "starting", startedAt, workflowErrors)))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
const defaultCliVersion = await features.getDefaultCliVersion(gitHubVersion.type);
|
||||||
if (codeQLDefaultVersionInfo.variant === util_1.GitHubVariant.DOTCOM) {
|
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, await (0, util_1.shouldBypassToolcache)(features, (0, actions_util_1.getOptionalInput)("tools"), (0, actions_util_1.getOptionalInput)("languages"), repositoryNwo, logger), defaultCliVersion, logger);
|
||||||
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
|
|
||||||
}
|
|
||||||
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, await (0, util_1.shouldBypassToolcache)(features, (0, actions_util_1.getOptionalInput)("tools"), (0, actions_util_1.getOptionalInput)("languages"), repositoryNwo, logger), codeQLDefaultVersionInfo, logger);
|
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs;
|
|
||||||
toolsVersion = initCodeQLResult.toolsVersion;
|
toolsVersion = initCodeQLResult.toolsVersion;
|
||||||
toolsSource = initCodeQLResult.toolsSource;
|
|
||||||
await (0, util_1.enrichEnvironment)(codeql);
|
await (0, util_1.enrichEnvironment)(codeql);
|
||||||
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("registries"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), await getTrapCachingEnabled(features),
|
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("registries"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), await getTrapCachingEnabled(features),
|
||||||
// Debug mode is enabled if:
|
// Debug mode is enabled if:
|
||||||
@@ -187,10 +159,10 @@ async function run() {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(String(error));
|
core.setFailed(String(error));
|
||||||
console.log(error);
|
console.log(error);
|
||||||
await sendInitStatusReport((0, actions_util_1.getActionsStatus)(error), startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger);
|
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", (0, actions_util_1.getActionsStatus)(error), startedAt, String(error), error instanceof Error ? error.stack : undefined));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await sendInitStatusReport("success", startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger);
|
await sendSuccessStatusReport(startedAt, config, toolsVersion, logger);
|
||||||
}
|
}
|
||||||
async function getTrapCachingEnabled(featureEnablement) {
|
async function getTrapCachingEnabled(featureEnablement) {
|
||||||
// If the workflow specified something always respect that
|
// If the workflow specified something always respect that
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+3
-10
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.installPythonDeps = exports.injectWindowsTracer = exports.runInit = exports.initConfig = exports.initCodeQL = exports.ToolsSource = void 0;
|
exports.installPythonDeps = exports.injectWindowsTracer = exports.runInit = exports.initConfig = exports.initCodeQL = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
@@ -34,19 +34,12 @@ const configUtils = __importStar(require("./config-utils"));
|
|||||||
const tracer_config_1 = require("./tracer-config");
|
const tracer_config_1 = require("./tracer-config");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
var ToolsSource;
|
|
||||||
(function (ToolsSource) {
|
|
||||||
ToolsSource["Unknown"] = "UNKNOWN";
|
|
||||||
ToolsSource["Local"] = "LOCAL";
|
|
||||||
ToolsSource["Toolcache"] = "TOOLCACHE";
|
|
||||||
ToolsSource["Download"] = "DOWNLOAD";
|
|
||||||
})(ToolsSource = exports.ToolsSource || (exports.ToolsSource = {}));
|
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger, true);
|
const { codeql, toolsVersion } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, bypassToolcache, defaultCliVersion, logger, true);
|
||||||
await codeql.printVersion();
|
await codeql.printVersion();
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
return { codeql, toolsVersion };
|
||||||
}
|
}
|
||||||
exports.initCodeQL = initCodeQL;
|
exports.initCodeQL = initCodeQL;
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureEnablement, logger) {
|
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureEnablement, logger) {
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gE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le = exports.getCodeQLURLVersion = exports.downloadCodeQL = exports.getCodeQLSource = exports.convertToSemVer = exports.getBundleVersionFromUrl = exports.tryFindCliVersionDotcomOnly = exports.findCodeQLBundleTagDotcomOnly = exports.getCodeQLActionRepository = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = void 0;
|
exports.setupCodeQLBundle = exports.getCodeQLURLVersion = exports.downloadCodeQL = exports.getCodeQLSource = exports.convertToSemVer = exports.getBundleVersionFromUrl = exports.tryFindCliVersionDotcomOnly = exports.findCodeQLBundleTagDotcomOnly = exports.getCodeQLActionRepository = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const perf_hooks_1 = require("perf_hooks");
|
|
||||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||||
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
@@ -40,7 +39,6 @@ const api = __importStar(require("./api-client"));
|
|||||||
// creation scripts. Ensure that any changes to the format of this file are compatible with both of
|
// creation scripts. Ensure that any changes to the format of this file are compatible with both of
|
||||||
// these dependents.
|
// these dependents.
|
||||||
const defaults = __importStar(require("./defaults.json"));
|
const defaults = __importStar(require("./defaults.json"));
|
||||||
const init_1 = require("./init");
|
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
exports.CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
exports.CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
||||||
@@ -211,19 +209,12 @@ async function getCodeQLBundleDownloadURL(tagName, apiDetails, variant, logger)
|
|||||||
}
|
}
|
||||||
return `https://github.com/${exports.CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${tagName}/${codeQLBundleName}`;
|
return `https://github.com/${exports.CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${tagName}/${codeQLBundleName}`;
|
||||||
}
|
}
|
||||||
function getBundleVersionFromTagName(tagName) {
|
|
||||||
const match = tagName.match(/^codeql-bundle-(.*)$/);
|
|
||||||
if (match === null || match.length < 2) {
|
|
||||||
throw new Error(`Malformed bundle tag name: ${tagName}. Bundle version could not be inferred`);
|
|
||||||
}
|
|
||||||
return match[1];
|
|
||||||
}
|
|
||||||
function getBundleVersionFromUrl(url) {
|
function getBundleVersionFromUrl(url) {
|
||||||
const match = url.match(/\/(codeql-bundle-.*)\//);
|
const match = url.match(/\/codeql-bundle-(.*)\//);
|
||||||
if (match === null || match.length < 2) {
|
if (match === null || match.length < 2) {
|
||||||
throw new Error(`Malformed tools url: ${url}. Bundle version could not be inferred`);
|
throw new Error(`Malformed tools url: ${url}. Bundle version could not be inferred`);
|
||||||
}
|
}
|
||||||
return getBundleVersionFromTagName(match[1]);
|
return match[1];
|
||||||
}
|
}
|
||||||
exports.getBundleVersionFromUrl = getBundleVersionFromUrl;
|
exports.getBundleVersionFromUrl = getBundleVersionFromUrl;
|
||||||
function convertToSemVer(version, logger) {
|
function convertToSemVer(version, logger) {
|
||||||
@@ -356,14 +347,14 @@ async function getCodeQLSource(toolsInput, bypassToolcache, defaultCliVersion, a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!codeqlFolder && requestedVersion.cliVersion) {
|
if (!codeqlFolder && requestedVersion.cliVersion) {
|
||||||
// Fall back to accepting a `0.0.0-<bundleVersion>` version if we didn't find the
|
// Fall back to accepting a `0.0.0-<tagName>` version if we didn't find the
|
||||||
// `x.y.z` version. This is to support old versions of the toolcache.
|
// `x.y.z` version. This is to support old versions of the toolcache.
|
||||||
//
|
//
|
||||||
// If we are on Dotcom, we will make an HTTP request to the Releases API here
|
// If we are on Dotcom, we will make an HTTP request to the Releases API here
|
||||||
// to find the tag name for the requested version.
|
// to find the tag name for the requested version.
|
||||||
tagName =
|
tagName =
|
||||||
tagName || (await getOrFindBundleTagName(requestedVersion, logger));
|
tagName || (await getOrFindBundleTagName(requestedVersion, logger));
|
||||||
const fallbackVersion = convertToSemVer(getBundleVersionFromTagName(tagName), logger);
|
const fallbackVersion = convertToSemVer(tagName, logger);
|
||||||
logger.debug(`Computed a fallback toolcache version number of ${fallbackVersion} for CodeQL tools version ` +
|
logger.debug(`Computed a fallback toolcache version number of ${fallbackVersion} for CodeQL tools version ` +
|
||||||
`${requestedVersion.cliVersion}.`);
|
`${requestedVersion.cliVersion}.`);
|
||||||
codeqlFolder = toolcache.find("CodeQL", fallbackVersion);
|
codeqlFolder = toolcache.find("CodeQL", fallbackVersion);
|
||||||
@@ -424,9 +415,7 @@ async function downloadCodeQL(codeqlURL, maybeCliVersion, apiDetails, variant, t
|
|||||||
logger.info(`Downloading CodeQL tools from ${codeqlURL}. This may take a while.`);
|
logger.info(`Downloading CodeQL tools from ${codeqlURL}. This may take a while.`);
|
||||||
const dest = path.join(tempDir, (0, uuid_1.v4)());
|
const dest = path.join(tempDir, (0, uuid_1.v4)());
|
||||||
const finalHeaders = Object.assign({ "User-Agent": "CodeQL Action" }, headers);
|
const finalHeaders = Object.assign({ "User-Agent": "CodeQL Action" }, headers);
|
||||||
const toolsDownloadStart = perf_hooks_1.performance.now();
|
|
||||||
const codeqlPath = await toolcache.downloadTool(codeqlURL, dest, undefined, finalHeaders);
|
const codeqlPath = await toolcache.downloadTool(codeqlURL, dest, undefined, finalHeaders);
|
||||||
const toolsDownloadDurationMs = perf_hooks_1.performance.now() - toolsDownloadStart;
|
|
||||||
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
|
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
|
||||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
|
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
|
||||||
const bundleVersion = getBundleVersionFromUrl(codeqlURL);
|
const bundleVersion = getBundleVersionFromUrl(codeqlURL);
|
||||||
@@ -450,7 +439,6 @@ async function downloadCodeQL(codeqlURL, maybeCliVersion, apiDetails, variant, t
|
|||||||
return {
|
return {
|
||||||
toolsVersion: cliVersion || toolcacheVersion,
|
toolsVersion: cliVersion || toolcacheVersion,
|
||||||
codeqlFolder: await toolcache.cacheDir(codeqlExtracted, "CodeQL", toolcacheVersion),
|
codeqlFolder: await toolcache.cacheDir(codeqlExtracted, "CodeQL", toolcacheVersion),
|
||||||
toolsDownloadDurationMs,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.downloadCodeQL = downloadCodeQL;
|
exports.downloadCodeQL = downloadCodeQL;
|
||||||
@@ -480,30 +468,24 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, bypas
|
|||||||
const source = await getCodeQLSource(toolsInput, bypassToolcache, defaultCliVersion, apiDetails, variant, logger);
|
const source = await getCodeQLSource(toolsInput, bypassToolcache, defaultCliVersion, apiDetails, variant, logger);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
let toolsVersion = source.toolsVersion;
|
let toolsVersion = source.toolsVersion;
|
||||||
let toolsDownloadDurationMs;
|
|
||||||
let toolsSource;
|
|
||||||
switch (source.sourceType) {
|
switch (source.sourceType) {
|
||||||
case "local":
|
case "local":
|
||||||
codeqlFolder = await toolcache.extractTar(source.codeqlTarPath);
|
codeqlFolder = await toolcache.extractTar(source.codeqlTarPath);
|
||||||
toolsSource = init_1.ToolsSource.Local;
|
|
||||||
break;
|
break;
|
||||||
case "toolcache":
|
case "toolcache":
|
||||||
codeqlFolder = source.codeqlFolder;
|
codeqlFolder = source.codeqlFolder;
|
||||||
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||||
toolsSource = init_1.ToolsSource.Toolcache;
|
|
||||||
break;
|
break;
|
||||||
case "download": {
|
case "download": {
|
||||||
const result = await downloadCodeQL(source.codeqlURL, source.cliVersion, apiDetails, variant, tempDir, logger);
|
const result = await downloadCodeQL(source.codeqlURL, source.cliVersion, apiDetails, variant, tempDir, logger);
|
||||||
toolsVersion = result.toolsVersion;
|
toolsVersion = result.toolsVersion;
|
||||||
codeqlFolder = result.codeqlFolder;
|
codeqlFolder = result.codeqlFolder;
|
||||||
toolsDownloadDurationMs = result.toolsDownloadDurationMs;
|
|
||||||
toolsSource = init_1.ToolsSource.Download;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
util.assertNever(source);
|
util.assertNever(source);
|
||||||
}
|
}
|
||||||
return { codeqlFolder, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
return { codeqlFolder, toolsVersion };
|
||||||
}
|
}
|
||||||
exports.setupCodeQLBundle = setupCodeQLBundle;
|
exports.setupCodeQLBundle = setupCodeQLBundle;
|
||||||
//# sourceMappingURL=setup-codeql.js.map
|
//# sourceMappingURL=setup-codeql.js.map
|
||||||
File diff suppressed because one or more lines are too long
+24
-17
@@ -557,9 +557,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/openapi-types": {
|
"node_modules/@octokit/openapi-types": {
|
||||||
"version": "16.0.0",
|
"version": "14.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-16.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-14.0.0.tgz",
|
||||||
"integrity": "sha512-JbFWOqTJVLHZSUUoF4FzAZKYtqdxWu9Z5m2QQnOyEa04fOFljvyh7D3GYKbfuaSWisqehImiVIMG4eyJeP5VEA=="
|
"integrity": "sha512-HNWisMYlR8VCnNurDU6os2ikx0s0VyEjDYHNS/h4cgb8DeOxQ0n72HyinUtdDVxJhFy3FWLGl0DJhfEWk3P5Iw=="
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/plugin-paginate-rest": {
|
"node_modules/@octokit/plugin-paginate-rest": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
@@ -596,18 +596,25 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/plugin-retry": {
|
"node_modules/@octokit/plugin-retry": {
|
||||||
"version": "4.0.4",
|
"version": "3.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-4.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz",
|
||||||
"integrity": "sha512-d7qGFLR3AH+WbNEDUvBPgMc7wRCxU40FZyNXFFqs8ISw75ZYS5/P3ScggzU13dCoY0aywYDxKugGstQTwNgppA==",
|
"integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/types": "^9.0.0",
|
"@octokit/types": "^6.0.3",
|
||||||
"bottleneck": "^2.15.3"
|
"bottleneck": "^2.15.3"
|
||||||
},
|
}
|
||||||
"engines": {
|
},
|
||||||
"node": ">= 14"
|
"node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": {
|
||||||
},
|
"version": "12.11.0",
|
||||||
"peerDependencies": {
|
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz",
|
||||||
"@octokit/core": ">=3"
|
"integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ=="
|
||||||
|
},
|
||||||
|
"node_modules/@octokit/plugin-retry/node_modules/@octokit/types": {
|
||||||
|
"version": "6.41.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz",
|
||||||
|
"integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@octokit/openapi-types": "^12.11.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/request": {
|
"node_modules/@octokit/request": {
|
||||||
@@ -650,11 +657,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/types": {
|
"node_modules/@octokit/types": {
|
||||||
"version": "9.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-8.0.0.tgz",
|
||||||
"integrity": "sha512-LUewfj94xCMH2rbD5YJ+6AQ4AVjFYTgpp6rboWM5T7N3IsIF65SBEOVcYMGAEzO/kKNiNaW4LoWtoThOhH06gw==",
|
"integrity": "sha512-65/TPpOJP1i3K4lBJMnWqPUJ6zuOtzhtagDvydAWbEXpbFYA0oMKKyLb95NFZZP0lSh/4b6K+DQlzvYQJQQePg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/openapi-types": "^16.0.0"
|
"@octokit/openapi-types": "^14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@opentelemetry/api": {
|
"node_modules/@opentelemetry/api": {
|
||||||
|
|||||||
+2
-2
@@ -9,12 +9,12 @@
|
|||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"version": "16.0.0",
|
"version": "14.0.0",
|
||||||
"main": "",
|
"main": "",
|
||||||
"types": "types.d.ts",
|
"types": "types.d.ts",
|
||||||
"author": "Gregor Martynus (https://twitter.com/gr2m)",
|
"author": "Gregor Martynus (https://twitter.com/gr2m)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"octokit": {
|
"octokit": {
|
||||||
"openapi-version": "10.0.0"
|
"openapi-version": "8.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3396
-75116
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
# plugin-retry.js
|
# plugin-retry.js
|
||||||
|
|
||||||
> Retries requests for server 4xx/5xx responses except `400`, `401`, `403`, `404`, and `422`.
|
> Retries requests for server 4xx/5xx responses except `400`, `401`, `403` and `404`.
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@octokit/plugin-retry)
|
[](https://www.npmjs.com/package/@octokit/plugin-retry)
|
||||||
[](https://github.com/octokit/plugin-retry.js/actions?workflow=Test)
|
[](https://github.com/octokit/plugin-retry.js/actions?workflow=Test)
|
||||||
@@ -76,7 +76,7 @@ const octokit = new MyOctokit({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
You can manually ask for retries for any request by passing `{ request: { retries: numRetries, retryAfter: delayInSeconds }}`. Note that the `doNotRetry` option from the constructor is ignored in this case, requests will be retried no matter their response code.
|
You can manually ask for retries for any request by passing `{ request: { retries: numRetries, retryAfter: delayInSeconds }}`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
octokit
|
octokit
|
||||||
|
|||||||
+13
-8
@@ -11,26 +11,29 @@ async function errorRequest(octokit, state, error, options) {
|
|||||||
if (!error.request || !error.request.request) {
|
if (!error.request || !error.request.request) {
|
||||||
// address https://github.com/octokit/plugin-retry.js/issues/8
|
// address https://github.com/octokit/plugin-retry.js/issues/8
|
||||||
throw error;
|
throw error;
|
||||||
}
|
} // retry all >= 400 && not doNotRetry
|
||||||
// retry all >= 400 && not doNotRetry
|
|
||||||
|
|
||||||
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
|
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
|
||||||
const retries = options.request.retries != null ? options.request.retries : state.retries;
|
const retries = options.request.retries != null ? options.request.retries : state.retries;
|
||||||
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
|
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
|
||||||
throw octokit.retry.retryRequest(error, retries, retryAfter);
|
throw octokit.retry.retryRequest(error, retries, retryAfter);
|
||||||
}
|
} // Maybe eventually there will be more cases here
|
||||||
// Maybe eventually there will be more cases here
|
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// @ts-ignore
|
|
||||||
async function wrapRequest(state, request, options) {
|
async function wrapRequest(state, request, options) {
|
||||||
const limiter = new Bottleneck();
|
const limiter = new Bottleneck(); // @ts-ignore
|
||||||
// @ts-ignore
|
|
||||||
limiter.on("failed", function (error, info) {
|
limiter.on("failed", function (error, info) {
|
||||||
const maxRetries = ~~error.request.request.retries;
|
const maxRetries = ~~error.request.request.retries;
|
||||||
const after = ~~error.request.request.retryAfter;
|
const after = ~~error.request.request.retryAfter;
|
||||||
options.request.retryCount = info.retryCount + 1;
|
options.request.retryCount = info.retryCount + 1;
|
||||||
|
|
||||||
if (maxRetries > info.retryCount) {
|
if (maxRetries > info.retryCount) {
|
||||||
// Returning a number instructs the limiter to retry
|
// Returning a number instructs the limiter to retry
|
||||||
// the request after that number of milliseconds have passed
|
// the request after that number of milliseconds have passed
|
||||||
@@ -40,7 +43,7 @@ async function wrapRequest(state, request, options) {
|
|||||||
return limiter.schedule(request, options);
|
return limiter.schedule(request, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "4.0.4";
|
const VERSION = "3.0.9";
|
||||||
function retry(octokit, octokitOptions) {
|
function retry(octokit, octokitOptions) {
|
||||||
const state = Object.assign({
|
const state = Object.assign({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -48,10 +51,12 @@ function retry(octokit, octokitOptions) {
|
|||||||
doNotRetry: [400, 401, 403, 404, 422],
|
doNotRetry: [400, 401, 403, 404, 422],
|
||||||
retries: 3
|
retries: 3
|
||||||
}, octokitOptions.retry);
|
}, octokitOptions.retry);
|
||||||
|
|
||||||
if (state.enabled) {
|
if (state.enabled) {
|
||||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
retry: {
|
retry: {
|
||||||
retryRequest: (error, retries, retryAfter) => {
|
retryRequest: (error, retries, retryAfter) => {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
|||||||
export const VERSION = "4.0.4";
|
export const VERSION = "3.0.9";
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
export declare const VERSION = "4.0.4";
|
export declare const VERSION = "3.0.9";
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ async function wrapRequest(state, request, options) {
|
|||||||
return limiter.schedule(request, options);
|
return limiter.schedule(request, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "4.0.4";
|
const VERSION = "3.0.9";
|
||||||
function retry(octokit, octokitOptions) {
|
function retry(octokit, octokitOptions) {
|
||||||
const state = Object.assign({
|
const state = Object.assign({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"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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AC;AAChC,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,mBAAmB,EAAE,IAAI;AACjC,QAAQ,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,"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 = \"3.0.9\";\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,QA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ining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
# @octokit/openapi-types
|
||||||
|
|
||||||
|
> Generated TypeScript definitions based on GitHub's OpenAPI spec
|
||||||
|
|
||||||
|
This package is continously updated based on [GitHub's OpenAPI specification](https://github.com/github/rest-api-description/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { components } from "@octokit/openapi-types";
|
||||||
|
|
||||||
|
type Repository = components["schemas"]["full-repository"];
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "@octokit/openapi-types",
|
||||||
|
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/octokit/openapi-types.ts.git",
|
||||||
|
"directory": "packages/openapi-types"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"version": "12.11.0",
|
||||||
|
"main": "",
|
||||||
|
"types": "types.d.ts",
|
||||||
|
"author": "Gregor Martynus (https://twitter.com/gr2m)",
|
||||||
|
"license": "MIT",
|
||||||
|
"octokit": {
|
||||||
|
"openapi-version": "6.8.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
Vendored
+47095
File diff suppressed because it is too large
Load Diff
+7
@@ -0,0 +1,7 @@
|
|||||||
|
MIT License Copyright (c) 2019 Octokit contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
# types.ts
|
||||||
|
|
||||||
|
> Shared TypeScript definitions for Octokit projects
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/@octokit/types)
|
||||||
|
[](https://github.com/octokit/types.ts/actions?workflow=Test)
|
||||||
|
|
||||||
|
<!-- toc -->
|
||||||
|
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Examples](#examples)
|
||||||
|
- [Get parameter and response data types for a REST API endpoint](#get-parameter-and-response-data-types-for-a-rest-api-endpoint)
|
||||||
|
- [Get response types from endpoint methods](#get-response-types-from-endpoint-methods)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
<!-- tocstop -->
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
See all exported types at https://octokit.github.io/types.ts
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Get parameter and response data types for a REST API endpoint
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { Endpoints } from "@octokit/types";
|
||||||
|
|
||||||
|
type listUserReposParameters =
|
||||||
|
Endpoints["GET /repos/{owner}/{repo}"]["parameters"];
|
||||||
|
type listUserReposResponse = Endpoints["GET /repos/{owner}/{repo}"]["response"];
|
||||||
|
|
||||||
|
async function listRepos(
|
||||||
|
options: listUserReposParameters
|
||||||
|
): listUserReposResponse["data"] {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get response types from endpoint methods
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import {
|
||||||
|
GetResponseTypeFromEndpointMethod,
|
||||||
|
GetResponseDataTypeFromEndpointMethod,
|
||||||
|
} from "@octokit/types";
|
||||||
|
import { Octokit } from "@octokit/rest";
|
||||||
|
|
||||||
|
const octokit = new Octokit();
|
||||||
|
type CreateLabelResponseType = GetResponseTypeFromEndpointMethod<
|
||||||
|
typeof octokit.issues.createLabel
|
||||||
|
>;
|
||||||
|
type CreateLabelResponseDataType = GetResponseDataTypeFromEndpointMethod<
|
||||||
|
typeof octokit.issues.createLabel
|
||||||
|
>;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
const VERSION = "6.41.0";
|
||||||
|
|
||||||
|
exports.VERSION = VERSION;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sources":["../dist-src/VERSION.js"],"sourcesContent":["export const VERSION = \"0.0.0-development\";\n"],"names":["VERSION"],"mappings":";;;;MAAaA,OAAO,GAAG;;;;"}
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export const VERSION = "6.41.0";
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
export * from "./AuthInterface";
|
||||||
|
export * from "./EndpointDefaults";
|
||||||
|
export * from "./EndpointInterface";
|
||||||
|
export * from "./EndpointOptions";
|
||||||
|
export * from "./Fetch";
|
||||||
|
export * from "./OctokitResponse";
|
||||||
|
export * from "./RequestError";
|
||||||
|
export * from "./RequestHeaders";
|
||||||
|
export * from "./RequestInterface";
|
||||||
|
export * from "./RequestMethod";
|
||||||
|
export * from "./RequestOptions";
|
||||||
|
export * from "./RequestParameters";
|
||||||
|
export * from "./RequestRequestOptions";
|
||||||
|
export * from "./ResponseHeaders";
|
||||||
|
export * from "./Route";
|
||||||
|
export * from "./Signal";
|
||||||
|
export * from "./StrategyInterface";
|
||||||
|
export * from "./Url";
|
||||||
|
export * from "./VERSION";
|
||||||
|
export * from "./GetResponseTypeFromEndpointMethod";
|
||||||
|
export * from "./generated/Endpoints";
|
||||||
Generated
Vendored
+31
@@ -0,0 +1,31 @@
|
|||||||
|
import { EndpointOptions } from "./EndpointOptions";
|
||||||
|
import { OctokitResponse } from "./OctokitResponse";
|
||||||
|
import { RequestInterface } from "./RequestInterface";
|
||||||
|
import { RequestParameters } from "./RequestParameters";
|
||||||
|
import { Route } from "./Route";
|
||||||
|
/**
|
||||||
|
* Interface to implement complex authentication strategies for Octokit.
|
||||||
|
* An object Implementing the AuthInterface can directly be passed as the
|
||||||
|
* `auth` option in the Octokit constructor.
|
||||||
|
*
|
||||||
|
* For the official implementations of the most common authentication
|
||||||
|
* strategies, see https://github.com/octokit/auth.js
|
||||||
|
*/
|
||||||
|
export interface AuthInterface<AuthOptions extends any[], Authentication extends any> {
|
||||||
|
(...args: AuthOptions): Promise<Authentication>;
|
||||||
|
hook: {
|
||||||
|
/**
|
||||||
|
* Sends a request using the passed `request` instance
|
||||||
|
*
|
||||||
|
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<T = any>(request: RequestInterface, options: EndpointOptions): Promise<OctokitResponse<T>>;
|
||||||
|
/**
|
||||||
|
* Sends a request using the passed `request` instance
|
||||||
|
*
|
||||||
|
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
|
||||||
|
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<T = any>(request: RequestInterface, route: Route, parameters?: RequestParameters): Promise<OctokitResponse<T>>;
|
||||||
|
};
|
||||||
|
}
|
||||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
import { RequestHeaders } from "./RequestHeaders";
|
||||||
|
import { RequestMethod } from "./RequestMethod";
|
||||||
|
import { RequestParameters } from "./RequestParameters";
|
||||||
|
import { Url } from "./Url";
|
||||||
|
/**
|
||||||
|
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
|
||||||
|
* as well as the method property.
|
||||||
|
*/
|
||||||
|
export declare type EndpointDefaults = RequestParameters & {
|
||||||
|
baseUrl: Url;
|
||||||
|
method: RequestMethod;
|
||||||
|
url?: Url;
|
||||||
|
headers: RequestHeaders & {
|
||||||
|
accept: string;
|
||||||
|
"user-agent": string;
|
||||||
|
};
|
||||||
|
mediaType: {
|
||||||
|
format: string;
|
||||||
|
previews: string[];
|
||||||
|
};
|
||||||
|
};
|
||||||
Generated
Vendored
+65
@@ -0,0 +1,65 @@
|
|||||||
|
import { EndpointDefaults } from "./EndpointDefaults";
|
||||||
|
import { RequestOptions } from "./RequestOptions";
|
||||||
|
import { RequestParameters } from "./RequestParameters";
|
||||||
|
import { Route } from "./Route";
|
||||||
|
import { Endpoints } from "./generated/Endpoints";
|
||||||
|
export interface EndpointInterface<D extends object = object> {
|
||||||
|
/**
|
||||||
|
* Transforms a GitHub REST API endpoint into generic request options
|
||||||
|
*
|
||||||
|
* @param {object} endpoint Must set `url` unless it's set defaults. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<O extends RequestParameters = RequestParameters>(options: O & {
|
||||||
|
method?: string;
|
||||||
|
} & ("url" extends keyof D ? {
|
||||||
|
url?: string;
|
||||||
|
} : {
|
||||||
|
url: string;
|
||||||
|
})): RequestOptions & Pick<D & O, keyof RequestOptions>;
|
||||||
|
/**
|
||||||
|
* Transforms a GitHub REST API endpoint into generic request options
|
||||||
|
*
|
||||||
|
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
|
||||||
|
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): (R extends keyof Endpoints ? Endpoints[R]["request"] : RequestOptions) & Pick<P, keyof RequestOptions>;
|
||||||
|
/**
|
||||||
|
* Object with current default route and parameters
|
||||||
|
*/
|
||||||
|
DEFAULTS: D & EndpointDefaults;
|
||||||
|
/**
|
||||||
|
* Returns a new `endpoint` interface with new defaults
|
||||||
|
*/
|
||||||
|
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => EndpointInterface<D & O>;
|
||||||
|
merge: {
|
||||||
|
/**
|
||||||
|
* Merges current endpoint defaults with passed route and parameters,
|
||||||
|
* without transforming them into request options.
|
||||||
|
*
|
||||||
|
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
|
||||||
|
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
<R extends Route, P extends RequestParameters = R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters>(route: keyof Endpoints | R, parameters?: P): D & (R extends keyof Endpoints ? Endpoints[R]["request"] & Endpoints[R]["parameters"] : EndpointDefaults) & P;
|
||||||
|
/**
|
||||||
|
* Merges current endpoint defaults with passed route and parameters,
|
||||||
|
* without transforming them into request options.
|
||||||
|
*
|
||||||
|
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<P extends RequestParameters = RequestParameters>(options: P): EndpointDefaults & D & P;
|
||||||
|
/**
|
||||||
|
* Returns current default options.
|
||||||
|
*
|
||||||
|
* @deprecated use endpoint.DEFAULTS instead
|
||||||
|
*/
|
||||||
|
(): D & EndpointDefaults;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Stateless method to turn endpoint options into request options.
|
||||||
|
* Calling `endpoint(options)` is the same as calling `endpoint.parse(endpoint.merge(options))`.
|
||||||
|
*
|
||||||
|
* @param {object} options `method`, `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
parse: <O extends EndpointDefaults = EndpointDefaults>(options: O) => RequestOptions & Pick<O, keyof RequestOptions>;
|
||||||
|
}
|
||||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
import { RequestMethod } from "./RequestMethod";
|
||||||
|
import { Url } from "./Url";
|
||||||
|
import { RequestParameters } from "./RequestParameters";
|
||||||
|
export declare type EndpointOptions = RequestParameters & {
|
||||||
|
method: RequestMethod;
|
||||||
|
url: Url;
|
||||||
|
};
|
||||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* Browser's fetch method (or compatible such as fetch-mock)
|
||||||
|
*/
|
||||||
|
export declare type Fetch = any;
|
||||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
declare type Unwrap<T> = T extends Promise<infer U> ? U : T;
|
||||||
|
declare type AnyFunction = (...args: any[]) => any;
|
||||||
|
export declare type GetResponseTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>;
|
||||||
|
export declare type GetResponseDataTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>["data"];
|
||||||
|
export {};
|
||||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
import { ResponseHeaders } from "./ResponseHeaders";
|
||||||
|
import { Url } from "./Url";
|
||||||
|
export declare type OctokitResponse<T, S extends number = number> = {
|
||||||
|
headers: ResponseHeaders;
|
||||||
|
/**
|
||||||
|
* http response code
|
||||||
|
*/
|
||||||
|
status: S;
|
||||||
|
/**
|
||||||
|
* URL of response after all redirects
|
||||||
|
*/
|
||||||
|
url: Url;
|
||||||
|
/**
|
||||||
|
* Response data as documented in the REST API reference documentation at https://docs.github.com/rest/reference
|
||||||
|
*/
|
||||||
|
data: T;
|
||||||
|
};
|
||||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
export declare type RequestError = {
|
||||||
|
name: string;
|
||||||
|
status: number;
|
||||||
|
documentation_url: string;
|
||||||
|
errors?: Array<{
|
||||||
|
resource: string;
|
||||||
|
code: string;
|
||||||
|
field: string;
|
||||||
|
message?: string;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
export declare type RequestHeaders = {
|
||||||
|
/**
|
||||||
|
* Avoid setting `headers.accept`, use `mediaType.{format|previews}` option instead.
|
||||||
|
*/
|
||||||
|
accept?: string;
|
||||||
|
/**
|
||||||
|
* Use `authorization` to send authenticated request, remember `token ` / `bearer ` prefixes. Example: `token 1234567890abcdef1234567890abcdef12345678`
|
||||||
|
*/
|
||||||
|
authorization?: string;
|
||||||
|
/**
|
||||||
|
* `user-agent` is set do a default and can be overwritten as needed.
|
||||||
|
*/
|
||||||
|
"user-agent"?: string;
|
||||||
|
[header: string]: string | number | undefined;
|
||||||
|
};
|
||||||
Generated
Vendored
+34
@@ -0,0 +1,34 @@
|
|||||||
|
import { EndpointInterface } from "./EndpointInterface";
|
||||||
|
import { OctokitResponse } from "./OctokitResponse";
|
||||||
|
import { RequestParameters } from "./RequestParameters";
|
||||||
|
import { Route } from "./Route";
|
||||||
|
import { Endpoints } from "./generated/Endpoints";
|
||||||
|
export interface RequestInterface<D extends object = object> {
|
||||||
|
/**
|
||||||
|
* Sends a request based on endpoint options
|
||||||
|
*
|
||||||
|
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<T = any, O extends RequestParameters = RequestParameters>(options: O & {
|
||||||
|
method?: string;
|
||||||
|
} & ("url" extends keyof D ? {
|
||||||
|
url?: string;
|
||||||
|
} : {
|
||||||
|
url: string;
|
||||||
|
})): Promise<OctokitResponse<T>>;
|
||||||
|
/**
|
||||||
|
* Sends a request based on endpoint options
|
||||||
|
*
|
||||||
|
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
|
||||||
|
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
||||||
|
*/
|
||||||
|
<R extends Route>(route: keyof Endpoints | R, options?: R extends keyof Endpoints ? Endpoints[R]["parameters"] & RequestParameters : RequestParameters): R extends keyof Endpoints ? Promise<Endpoints[R]["response"]> : Promise<OctokitResponse<any>>;
|
||||||
|
/**
|
||||||
|
* Returns a new `request` with updated route and parameters
|
||||||
|
*/
|
||||||
|
defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => RequestInterface<D & O>;
|
||||||
|
/**
|
||||||
|
* Octokit endpoint API, see {@link https://github.com/octokit/endpoint.js|@octokit/endpoint}
|
||||||
|
*/
|
||||||
|
endpoint: EndpointInterface<D>;
|
||||||
|
}
|
||||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* HTTP Verb supported by GitHub's REST API
|
||||||
|
*/
|
||||||
|
export declare type RequestMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
|
||||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
import { RequestHeaders } from "./RequestHeaders";
|
||||||
|
import { RequestMethod } from "./RequestMethod";
|
||||||
|
import { RequestRequestOptions } from "./RequestRequestOptions";
|
||||||
|
import { Url } from "./Url";
|
||||||
|
/**
|
||||||
|
* Generic request options as they are returned by the `endpoint()` method
|
||||||
|
*/
|
||||||
|
export declare type RequestOptions = {
|
||||||
|
method: RequestMethod;
|
||||||
|
url: Url;
|
||||||
|
headers: RequestHeaders;
|
||||||
|
body?: any;
|
||||||
|
request?: RequestRequestOptions;
|
||||||
|
};
|
||||||
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
|||||||
|
import { RequestRequestOptions } from "./RequestRequestOptions";
|
||||||
|
import { RequestHeaders } from "./RequestHeaders";
|
||||||
|
import { Url } from "./Url";
|
||||||
|
/**
|
||||||
|
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
|
||||||
|
*/
|
||||||
|
export declare type RequestParameters = {
|
||||||
|
/**
|
||||||
|
* Base URL to be used when a relative URL is passed, such as `/orgs/{org}`.
|
||||||
|
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
|
||||||
|
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/{org}`.
|
||||||
|
*/
|
||||||
|
baseUrl?: Url;
|
||||||
|
/**
|
||||||
|
* HTTP headers. Use lowercase keys.
|
||||||
|
*/
|
||||||
|
headers?: RequestHeaders;
|
||||||
|
/**
|
||||||
|
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
|
||||||
|
*/
|
||||||
|
mediaType?: {
|
||||||
|
/**
|
||||||
|
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
|
||||||
|
*/
|
||||||
|
format?: string;
|
||||||
|
/**
|
||||||
|
* Custom media type names of {@link https://developer.github.com/v3/media/|API Previews} without the `-preview` suffix.
|
||||||
|
* Example for single preview: `['squirrel-girl']`.
|
||||||
|
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
|
||||||
|
*/
|
||||||
|
previews?: string[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Pass custom meta information for the request. The `request` object will be returned as is.
|
||||||
|
*/
|
||||||
|
request?: RequestRequestOptions;
|
||||||
|
/**
|
||||||
|
* Any additional parameter will be passed as follows
|
||||||
|
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
|
||||||
|
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
|
||||||
|
* 3. Request body if `parameter` is `'data'`
|
||||||
|
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
|
||||||
|
*/
|
||||||
|
[parameter: string]: unknown;
|
||||||
|
};
|
||||||
node_modules/@octokit/plugin-retry/node_modules/@octokit/types/dist-types/RequestRequestOptions.d.ts
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
import { Fetch } from "./Fetch";
|
||||||
|
import { Signal } from "./Signal";
|
||||||
|
/**
|
||||||
|
* Octokit-specific request options which are ignored for the actual request, but can be used by Octokit or plugins to manipulate how the request is sent or how a response is handled
|
||||||
|
*/
|
||||||
|
export declare type RequestRequestOptions = {
|
||||||
|
/**
|
||||||
|
* Node only. Useful for custom proxy, certificate, or dns lookup.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/api/http.html#http_class_http_agent
|
||||||
|
*/
|
||||||
|
agent?: unknown;
|
||||||
|
/**
|
||||||
|
* Custom replacement for built-in fetch method. Useful for testing or request hooks.
|
||||||
|
*/
|
||||||
|
fetch?: Fetch;
|
||||||
|
/**
|
||||||
|
* Use an `AbortController` instance to cancel a request. In node you can only cancel streamed requests.
|
||||||
|
*/
|
||||||
|
signal?: Signal;
|
||||||
|
/**
|
||||||
|
* Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). `options.request.signal` is recommended instead.
|
||||||
|
*/
|
||||||
|
timeout?: number;
|
||||||
|
[option: string]: any;
|
||||||
|
};
|
||||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
export declare type ResponseHeaders = {
|
||||||
|
"cache-control"?: string;
|
||||||
|
"content-length"?: number;
|
||||||
|
"content-type"?: string;
|
||||||
|
date?: string;
|
||||||
|
etag?: string;
|
||||||
|
"last-modified"?: string;
|
||||||
|
link?: string;
|
||||||
|
location?: string;
|
||||||
|
server?: string;
|
||||||
|
status?: string;
|
||||||
|
vary?: string;
|
||||||
|
"x-github-mediatype"?: string;
|
||||||
|
"x-github-request-id"?: string;
|
||||||
|
"x-oauth-scopes"?: string;
|
||||||
|
"x-ratelimit-limit"?: string;
|
||||||
|
"x-ratelimit-remaining"?: string;
|
||||||
|
"x-ratelimit-reset"?: string;
|
||||||
|
[header: string]: string | number | undefined;
|
||||||
|
};
|
||||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* String consisting of an optional HTTP method and relative path or absolute URL. Examples: `'/orgs/{org}'`, `'PUT /orgs/{org}'`, `GET https://example.com/foo/bar`
|
||||||
|
*/
|
||||||
|
export declare type Route = string;
|
||||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Abort signal
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
||||||
|
*/
|
||||||
|
export declare type Signal = any;
|
||||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
import { AuthInterface } from "./AuthInterface";
|
||||||
|
export interface StrategyInterface<StrategyOptions extends any[], AuthOptions extends any[], Authentication extends object> {
|
||||||
|
(...args: StrategyOptions): AuthInterface<AuthOptions, Authentication>;
|
||||||
|
}
|
||||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* Relative or absolute URL. Examples: `'/orgs/{org}'`, `https://example.com/foo/bar`
|
||||||
|
*/
|
||||||
|
export declare type Url = string;
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export declare const VERSION = "6.41.0";
|
||||||
Generated
Vendored
+3571
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
export * from "./AuthInterface";
|
||||||
|
export * from "./EndpointDefaults";
|
||||||
|
export * from "./EndpointInterface";
|
||||||
|
export * from "./EndpointOptions";
|
||||||
|
export * from "./Fetch";
|
||||||
|
export * from "./OctokitResponse";
|
||||||
|
export * from "./RequestError";
|
||||||
|
export * from "./RequestHeaders";
|
||||||
|
export * from "./RequestInterface";
|
||||||
|
export * from "./RequestMethod";
|
||||||
|
export * from "./RequestOptions";
|
||||||
|
export * from "./RequestParameters";
|
||||||
|
export * from "./RequestRequestOptions";
|
||||||
|
export * from "./ResponseHeaders";
|
||||||
|
export * from "./Route";
|
||||||
|
export * from "./Signal";
|
||||||
|
export * from "./StrategyInterface";
|
||||||
|
export * from "./Url";
|
||||||
|
export * from "./VERSION";
|
||||||
|
export * from "./GetResponseTypeFromEndpointMethod";
|
||||||
|
export * from "./generated/Endpoints";
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
const VERSION = "6.41.0";
|
||||||
|
|
||||||
|
export { VERSION };
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sources":["../dist-src/VERSION.js"],"sourcesContent":["export const VERSION = \"0.0.0-development\";\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"name": "@octokit/types",
|
||||||
|
"description": "Shared TypeScript definitions for Octokit projects",
|
||||||
|
"version": "6.41.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"files": [
|
||||||
|
"dist-*/",
|
||||||
|
"bin/"
|
||||||
|
],
|
||||||
|
"source": "dist-src/index.js",
|
||||||
|
"types": "dist-types/index.d.ts",
|
||||||
|
"octokit": {
|
||||||
|
"openapi-version": "6.8.0"
|
||||||
|
},
|
||||||
|
"main": "dist-node/index.js",
|
||||||
|
"module": "dist-web/index.js",
|
||||||
|
"pika": true,
|
||||||
|
"sideEffects": false,
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"api",
|
||||||
|
"sdk",
|
||||||
|
"toolkit",
|
||||||
|
"typescript"
|
||||||
|
],
|
||||||
|
"repository": "github:octokit/types.ts",
|
||||||
|
"dependencies": {
|
||||||
|
"@octokit/openapi-types": "^12.11.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@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",
|
||||||
|
"@types/node": ">= 8",
|
||||||
|
"github-openapi-graphql-query": "^2.0.0",
|
||||||
|
"handlebars": "^4.7.6",
|
||||||
|
"json-schema-to-typescript": "^11.0.0",
|
||||||
|
"lodash.set": "^4.3.2",
|
||||||
|
"npm-run-all": "^4.1.5",
|
||||||
|
"pascal-case": "^3.1.1",
|
||||||
|
"pika-plugin-merge-properties": "^1.0.6",
|
||||||
|
"prettier": "^2.0.0",
|
||||||
|
"semantic-release": "^19.0.3",
|
||||||
|
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||||
|
"sort-keys": "^4.2.0",
|
||||||
|
"string-to-jsdoc-comment": "^1.0.0",
|
||||||
|
"typedoc": "^0.23.0",
|
||||||
|
"typescript": "^4.0.2"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-21
@@ -1,47 +1,42 @@
|
|||||||
{
|
{
|
||||||
"name": "@octokit/plugin-retry",
|
"name": "@octokit/plugin-retry",
|
||||||
"description": "Automatic retry plugin for octokit",
|
"description": "Automatic retry plugin for octokit",
|
||||||
"version": "4.0.4",
|
"version": "3.0.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
"dist-*/",
|
"dist-*/",
|
||||||
"bin/"
|
"bin/"
|
||||||
],
|
],
|
||||||
"source": "dist-src/index.js",
|
|
||||||
"types": "dist-types/index.d.ts",
|
|
||||||
"main": "dist-node/index.js",
|
|
||||||
"module": "dist-web/index.js",
|
|
||||||
"pika": true,
|
"pika": true,
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"repository": "github:octokit/plugin-retry.js",
|
"repository": "github:octokit/plugin-retry.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/types": "^9.0.0",
|
"@octokit/types": "^6.0.3",
|
||||||
"bottleneck": "^2.15.3"
|
"bottleneck": "^2.15.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
|
||||||
"@octokit/core": ">=3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/core": "^4.0.0",
|
"@octokit/core": "^3.0.0",
|
||||||
"@octokit/request-error": "^3.0.0",
|
"@octokit/request-error": "^2.0.0",
|
||||||
"@pika/pack": "^0.3.7",
|
"@pika/pack": "^0.5.0",
|
||||||
"@pika/plugin-build-node": "^0.9.0",
|
"@pika/plugin-build-node": "^0.9.0",
|
||||||
"@pika/plugin-build-web": "^0.9.0",
|
"@pika/plugin-build-web": "^0.9.0",
|
||||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||||
"@types/fetch-mock": "^7.3.1",
|
"@types/fetch-mock": "^7.3.1",
|
||||||
"@types/jest": "^29.0.0",
|
"@types/jest": "^26.0.0",
|
||||||
"@types/node": "^18.0.0",
|
"@types/node": "^14.0.0",
|
||||||
"fetch-mock": "^9.0.0",
|
"fetch-mock": "^9.0.0",
|
||||||
"jest": "^29.0.0",
|
"jest": "^27.0.0",
|
||||||
"prettier": "2.8.3",
|
"prettier": "2.3.1",
|
||||||
|
"semantic-release": "^17.0.0",
|
||||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||||
"ts-jest": "^29.0.0",
|
"ts-jest": "^27.0.0-next.12",
|
||||||
"typescript": "^4.0.2"
|
"typescript": "^4.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": ">= 14"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
}
|
},
|
||||||
|
"source": "dist-src/index.js",
|
||||||
|
"types": "dist-types/index.d.ts",
|
||||||
|
"main": "dist-node/index.js",
|
||||||
|
"module": "dist-web/index.js"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
const VERSION = "9.0.0";
|
const VERSION = "8.0.0";
|
||||||
|
|
||||||
exports.VERSION = VERSION;
|
exports.VERSION = VERSION;
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
export const VERSION = "9.0.0";
|
export const VERSION = "8.0.0";
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import { Url } from "./Url";
|
|||||||
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
|
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
|
||||||
* as well as the method property.
|
* as well as the method property.
|
||||||
*/
|
*/
|
||||||
export type EndpointDefaults = RequestParameters & {
|
export declare type EndpointDefaults = RequestParameters & {
|
||||||
baseUrl: Url;
|
baseUrl: Url;
|
||||||
method: RequestMethod;
|
method: RequestMethod;
|
||||||
url?: Url;
|
url?: Url;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { RequestMethod } from "./RequestMethod";
|
import { RequestMethod } from "./RequestMethod";
|
||||||
import { Url } from "./Url";
|
import { Url } from "./Url";
|
||||||
import { RequestParameters } from "./RequestParameters";
|
import { RequestParameters } from "./RequestParameters";
|
||||||
export type EndpointOptions = RequestParameters & {
|
export declare type EndpointOptions = RequestParameters & {
|
||||||
method: RequestMethod;
|
method: RequestMethod;
|
||||||
url: Url;
|
url: Url;
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* Browser's fetch method (or compatible such as fetch-mock)
|
* Browser's fetch method (or compatible such as fetch-mock)
|
||||||
*/
|
*/
|
||||||
export type Fetch = any;
|
export declare type Fetch = any;
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
type Unwrap<T> = T extends Promise<infer U> ? U : T;
|
declare type Unwrap<T> = T extends Promise<infer U> ? U : T;
|
||||||
type AnyFunction = (...args: any[]) => any;
|
declare type AnyFunction = (...args: any[]) => any;
|
||||||
export type GetResponseTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>;
|
export declare type GetResponseTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>;
|
||||||
export type GetResponseDataTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>["data"];
|
export declare type GetResponseDataTypeFromEndpointMethod<T extends AnyFunction> = Unwrap<ReturnType<T>>["data"];
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { ResponseHeaders } from "./ResponseHeaders";
|
import { ResponseHeaders } from "./ResponseHeaders";
|
||||||
import { Url } from "./Url";
|
import { Url } from "./Url";
|
||||||
export type OctokitResponse<T, S extends number = number> = {
|
export declare type OctokitResponse<T, S extends number = number> = {
|
||||||
headers: ResponseHeaders;
|
headers: ResponseHeaders;
|
||||||
/**
|
/**
|
||||||
* http response code
|
* http response code
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user