Make 'source-root' init input relative to github.workspace

In the previous commit, the default value of the input is ${{ github.workspace }}
which means that most uses of this input would probably prefix their paths with
${{ github.workspace }}, especially since actions/checkout's 'path' input
must be under ${{ github.workspace }}. Therefore, it doesn't make much sense for
this to be an absolute file path.

Instead, it's more intuitive to make this relative to the repository.
This commit is contained in:
Mario Campos 2021-06-29 16:00:55 -05:00
parent 42babdf2c1
commit 337ae83a84
4 changed files with 13 additions and 9 deletions

View file

@ -1,3 +1,5 @@
import * as path from "path";
import * as core from "@actions/core";
import {
@ -201,11 +203,12 @@ async function run() {
const codeqlRam = process.env["CODEQL_RAM"] || "6500";
core.exportVariable("CODEQL_RAM", codeqlRam);
const tracerConfig = await runInit(
codeql,
config,
getRequiredInput("source-root")
const sourceRoot = path.join(
getRequiredEnvParam("GITHUB_WORKSPACE"),
getOptionalInput("source-root") || ""
);
const tracerConfig = await runInit(codeql, config, sourceRoot);
if (tracerConfig !== undefined) {
for (const [key, value] of Object.entries(tracerConfig.env)) {
core.exportVariable(key, value);