Skip to content

Commit

Permalink
Do not download CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg committed Jun 12, 2023
1 parent f95520d commit 6a72d37
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 59 deletions.
20 changes: 6 additions & 14 deletions lib/resolve-environment-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/resolve-environment-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions resolve-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: 'CodeQL: Resolve Build Environment'
description: '[Experimental] Attempt to infer a suitable environment configuration for the autobuilder'
author: 'GitHub'
inputs:
tools:
description: URL of CodeQL tools
required: false
# If not specified the Action will check in several places until it finds the CodeQL tools.
token:
default: ${{ github.token }}
matrix:
Expand Down
49 changes: 9 additions & 40 deletions src/resolve-environment-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,11 @@ import {
sendStatusReport,
} from "./actions-util";
import { getGitHubVersion } from "./api-client";
import { Features } from "./feature-flags";
import { initCodeQL } from "./init";
import * as configUtils from "./config-utils";
import { Language, resolveAlias } from "./languages";
import { getActionsLogger } from "./logging";
import { parseRepositoryNwo } from "./repository";
import { runResolveBuildEnvironment } from "./resolve-environment";
import {
checkForTimeout,
checkGitHubVersionInRange,
getRequiredEnvParam,
wrapError,
} from "./util";
import { checkForTimeout, checkGitHubVersionInRange, wrapError } from "./util";
import { validateWorkflow } from "./workflow";

const ACTION_NAME = "resolve-environment";
Expand All @@ -29,17 +22,6 @@ async function run() {
const logger = getActionsLogger();
const language: Language = resolveAlias(getRequiredInput("language"));

const apiDetails = {
auth: getRequiredInput("token"),
externalRepoAuth: getOptionalInput("external-repository-token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
apiURL: getRequiredEnvParam("GITHUB_API_URL"),
};

const repositoryNwo = parseRepositoryNwo(
getRequiredEnvParam("GITHUB_REPOSITORY")
);

try {
const workflowErrors = await validateWorkflow(logger);

Expand All @@ -59,29 +41,16 @@ async function run() {
const gitHubVersion = await getGitHubVersion();
checkGitHubVersionInRange(gitHubVersion, logger);

const features = new Features(
gitHubVersion,
repositoryNwo,
getTemporaryDirectory(),
logger
);

const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
gitHubVersion.type
);

const initCodeQLResult = await initCodeQL(
getOptionalInput("tools"),
apiDetails,
getTemporaryDirectory(),
gitHubVersion.type,
codeQLDefaultVersionInfo,
logger
);
const config = await configUtils.getConfig(getTemporaryDirectory(), logger);
if (config === undefined) {
throw new Error(
"Config file could not be found at expected location. Has the 'init' action been called?"
);
}

const workingDirectory = getOptionalInput("working-directory");
const result = await runResolveBuildEnvironment(
initCodeQLResult.codeql.getPath(),
config.codeQLCmd,
logger,
workingDirectory,
language
Expand Down

0 comments on commit 6a72d37

Please sign in to comment.