From d81cc671c0c6f5313836730a3bdc8b6e23b39f67 Mon Sep 17 00:00:00 2001 From: David Verdeguer Date: Tue, 6 Oct 2020 11:30:05 +0200 Subject: [PATCH] Guard python deps install --- lib/init-action.js | 13 ++++++++----- lib/init-action.js.map | 2 +- src/init-action.ts | 15 +++++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/init-action.js b/lib/init-action.js index 6c35a3eac7..1eed4d888e 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@actions/core")); const actionsUtil = __importStar(require("./actions-util")); const init_1 = require("./init"); +const languages_1 = require("./languages"); const logging_1 = require("./logging"); const repository_1 = require("./repository"); async function sendSuccessStatusReport(startedAt, config) { @@ -56,11 +57,13 @@ async function run() { } codeql = await init_1.initCodeQL(actionsUtil.getOptionalInput("tools"), actionsUtil.getRequiredInput("token"), actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"), actionsUtil.getRequiredEnvParam("RUNNER_TEMP"), actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"), "actions", logger); config = await init_1.initConfig(actionsUtil.getOptionalInput("languages"), actionsUtil.getOptionalInput("queries"), actionsUtil.getOptionalInput("config-file"), repository_1.parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")), actionsUtil.getRequiredEnvParam("RUNNER_TEMP"), actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"), codeql, actionsUtil.getRequiredEnvParam("GITHUB_WORKSPACE"), actionsUtil.getRequiredInput("token"), actionsUtil.getRequiredEnvParam("GITHUB_SERVER_URL"), logger); - try { - await init_1.installPythonDeps(codeql, logger); - } - catch (err) { - logger.warning(`${err.message} You can call this action with 'setup-python-dependencies: false' to disable this process`); + if (config.languages.includes(languages_1.Language.python)) { + try { + await init_1.installPythonDeps(codeql, logger); + } + catch (err) { + logger.warning(`${err.message} You can call this action with 'setup-python-dependencies: false' to disable this process`); + } } } catch (e) { diff --git a/lib/init-action.js.map b/lib/init-action.js.map index e9ef20a12a..eb5836c8f8 100644 --- a/lib/init-action.js.map +++ b/lib/init-action.js.map @@ -1 +1 @@ -{"version":3,"file":"init-action.js","sourceRoot":"","sources":["../src/init-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAG9C,iCAMgB;AAChB,uCAA6C;AAC7C,6CAAkD;AAkBlD,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,MAA0B;;IAE1B,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,sBAAsB,CAC/D,MAAM,EACN,SAAS,EACT,SAAS,CACV,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,iBAAiB,GAAG,WAAW,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CACvE,GAAG,CACJ,CAAC;IACF,MAAM,qBAAqB,GAAG,MAAM,CAAC,iBAAiB,CACpD,yBAAyB,CAC1B;QACC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,YAAY,SAAG,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,0CAAE,IAAI,EAAE,CAAC;IACnE,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC9D,OAAO,CAAC,IAAI,CACV,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAA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file diff --git a/src/init-action.ts b/src/init-action.ts index 5d0a0d7a9c..26b48c4378 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -10,6 +10,7 @@ import { installPythonDeps, runInit, } from "./init"; +import { Language } from "./languages"; import { getActionsLogger } from "./logging"; import { parseRepositoryNwo } from "./repository"; @@ -118,12 +119,14 @@ async function run() { logger ); - try { - await installPythonDeps(codeql, logger); - } catch (err) { - logger.warning( - `${err.message} You can call this action with 'setup-python-dependencies: false' to disable this process` - ); + if (config.languages.includes(Language.python)) { + try { + await installPythonDeps(codeql, logger); + } catch (err) { + logger.warning( + `${err.message} You can call this action with 'setup-python-dependencies: false' to disable this process` + ); + } } } catch (e) { core.setFailed(e.message);