Skip to content

Commit d09d89f

Browse files
Merge branch 'main' into robertbrignull/databases_url
2 parents 96edcdf + 1137e7d commit d09d89f

4 files changed

Lines changed: 26 additions & 46 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [UNRELEASED]
44

55
- The `init` step of the Action now supports a `source-root` input as a path to the root source-code directory. By default, the path is relative to $GITHUB_WORKSPACE. [#607](https://github.com/github/codeql-action/pull/607)
6+
- The `init` step will now try to install a few Python tools needed by this Action when running on a self-hosted runner. [#616](https://github.com/github/codeql-action/pull/616)
67

78
## 1.0.5 - 12 Jul 2021
89

lib/init.js

Lines changed: 11 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init.ts

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -195,32 +195,16 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
195195

196196
const scriptsFolder = path.resolve(__dirname, "../python-setup");
197197

198-
// Setup tools on the GitHub hosted runners
199-
if (process.env["ImageOS"] !== undefined) {
200-
try {
201-
if (process.platform === "win32") {
202-
await new toolrunner.ToolRunner(
203-
await safeWhich.safeWhich("powershell"),
204-
[path.join(scriptsFolder, "install_tools.ps1")]
205-
).exec();
206-
} else {
207-
await new toolrunner.ToolRunner(
208-
path.join(scriptsFolder, "install_tools.sh")
209-
).exec();
210-
}
211-
} catch (e) {
212-
// This script tries to install some needed tools in the runner. It should not fail, but if it does
213-
// we just abort the process without failing the action
214-
logger.endGroup();
215-
logger.warning(
216-
"Unable to download and extract the tools needed for installing the python dependencies. You can call this action with 'setup-python-dependencies: false' to disable this process."
217-
);
218-
return;
219-
}
220-
}
221-
222-
// Install dependencies
223198
try {
199+
if (process.platform === "win32") {
200+
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
201+
path.join(scriptsFolder, "install_tools.ps1"),
202+
]).exec();
203+
} else {
204+
await new toolrunner.ToolRunner(
205+
path.join(scriptsFolder, "install_tools.sh")
206+
).exec();
207+
}
224208
const script = "auto_install_packages.py";
225209
if (process.platform === "win32") {
226210
await new toolrunner.ToolRunner(await safeWhich.safeWhich("py"), [
@@ -236,7 +220,10 @@ export async function installPythonDeps(codeql: CodeQL, logger: Logger) {
236220
} catch (e) {
237221
logger.endGroup();
238222
logger.warning(
239-
"We were unable to install your python dependencies. You can call this action with 'setup-python-dependencies: false' to disable this process."
223+
`An error occurred while trying to automatically install Python dependencies: ${e}\n` +
224+
"Please make sure any necessary dependencies are installed before calling the codeql-action/analyze " +
225+
"step, and add a 'setup-python-dependencies: false' argument to this step to disable our automatic " +
226+
"dependency installation and avoid this warning."
240227
);
241228
return;
242229
}

0 commit comments

Comments
 (0)