Address PR comment.

This commit is contained in:
Edoardo Pirovano 2021-06-28 23:33:27 +01:00
parent 8f4c2c76ad
commit a7dac5c3db
No known key found for this signature in database
GPG key ID: 047556B5D93FFE28
4 changed files with 20 additions and 26 deletions

View file

@ -830,21 +830,21 @@ jobs:
runner/dist/codeql-runner-linux upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
multi-language-repo_test-local-codeql:
needs: [check-js, check-node-modules]
needs: [check-js, check-node-modules, check-codeql-versions]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Move codeql-action
run: |
wget ${{ fromJson(needs.check-codeql-versions.outputs.nightly-url) }}
wget ${{ needs.check-codeql-versions.outputs.nightly-url }}
mkdir ../action
mv * .github ../action/
mv ../action/tests/multi-language-repo/{*,.github} .
mv ../action/.github/workflows .github
- uses: ./../action/init
with:
tools: "file://../action/codeql-bundle.tar.gz"
tools: ../action/codeql-bundle.tar.gz
- name: Build code
run: ./build.sh
- uses: ./../action/analyze

17
lib/codeql.js generated
View file

@ -147,21 +147,20 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
return `https://github.com/${CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${CODEQL_BUNDLE_VERSION}/${codeQLBundleName}`;
}
async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) {
var _a;
try {
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest";
if (forceLatest) {
codeqlURL = undefined;
}
let codeqlFolder;
let codeqlURLVersion;
if ((_a = codeqlURL) === null || _a === void 0 ? void 0 : _a.startsWith("file://")) {
codeqlFolder = await toolcache.extractTar(codeqlURL.substr(7), tempDir, logger);
if (codeqlURL && !codeqlURL.startsWith("http")) {
codeqlFolder = await toolcache.extractTar(codeqlURL, tempDir, logger);
codeqlURLVersion = "local";
}
else {
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest";
if (forceLatest) {
codeqlURL = undefined;
}
codeqlURLVersion = getCodeQLURLVersion(codeqlURL || `/${CODEQL_BUNDLE_VERSION}/`);
const codeqlURLSemVer = convertToSemVer(codeqlURLVersion, logger);
// If we find the specified version, we always use that.

File diff suppressed because one or more lines are too long

View file

@ -312,23 +312,18 @@ export async function setupCodeQL(
logger: Logger
): Promise<{ codeql: CodeQL; toolsVersion: string }> {
try {
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest";
if (forceLatest) {
codeqlURL = undefined;
}
let codeqlFolder: string;
let codeqlURLVersion: string;
if (codeqlURL?.startsWith("file://")) {
codeqlFolder = await toolcache.extractTar(
codeqlURL.substr(7),
tempDir,
logger
);
if (codeqlURL && !codeqlURL.startsWith("http")) {
codeqlFolder = await toolcache.extractTar(codeqlURL, tempDir, logger);
codeqlURLVersion = "local";
} else {
// We use the special value of 'latest' to prioritize the version in the
// defaults over any pinned cached version.
const forceLatest = codeqlURL === "latest";
if (forceLatest) {
codeqlURL = undefined;
}
codeqlURLVersion = getCodeQLURLVersion(
codeqlURL || `/${CODEQL_BUNDLE_VERSION}/`
);