Add 'source-root' input to init action
This input is exposed in the CodeQL CLI as the flag --source-root, allowing
users of the CLI to set --source-root different from --working-dir. However,
in codeql-action, these two paths are conflated and it poses problems for
users with complicated build environments, in which a source root may be
a child of the working directory.
Most users should not notice this, as the default value is
${{ github.workspace }}, as it is implied now (`path.resolve()`).
This commit is contained in:
parent
c357ca73e4
commit
42babdf2c1
10 changed files with 22 additions and 14 deletions
|
|
@ -201,7 +201,11 @@ async function run() {
|
|||
const codeqlRam = process.env["CODEQL_RAM"] || "6500";
|
||||
core.exportVariable("CODEQL_RAM", codeqlRam);
|
||||
|
||||
const tracerConfig = await runInit(codeql, config);
|
||||
const tracerConfig = await runInit(
|
||||
codeql,
|
||||
config,
|
||||
getRequiredInput("source-root")
|
||||
);
|
||||
if (tracerConfig !== undefined) {
|
||||
for (const [key, value] of Object.entries(tracerConfig.env)) {
|
||||
core.exportVariable(key, value);
|
||||
|
|
|
|||
|
|
@ -73,10 +73,9 @@ export async function initConfig(
|
|||
|
||||
export async function runInit(
|
||||
codeql: CodeQL,
|
||||
config: configUtils.Config
|
||||
config: configUtils.Config,
|
||||
sourceRoot: string
|
||||
): Promise<TracerConfig | undefined> {
|
||||
const sourceRoot = path.resolve();
|
||||
|
||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||
|
||||
// TODO: replace this code once CodeQL supports multi-language tracing
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ program
|
|||
try {
|
||||
const tempDir = getTempDir(cmd.tempDir);
|
||||
const toolsDir = getToolsDir(cmd.toolsDir);
|
||||
const checkoutPath = cmd.checkoutPath || process.cwd();
|
||||
|
||||
// Wipe the temp dir
|
||||
logger.info(`Cleaning temp directory ${tempDir}`);
|
||||
|
|
@ -218,13 +219,13 @@ program
|
|||
tempDir,
|
||||
toolsDir,
|
||||
codeql,
|
||||
cmd.checkoutPath || process.cwd(),
|
||||
checkoutPath,
|
||||
gitHubVersion,
|
||||
apiDetails,
|
||||
logger
|
||||
);
|
||||
|
||||
const tracerConfig = await runInit(codeql, config);
|
||||
const tracerConfig = await runInit(codeql, config, checkoutPath);
|
||||
if (tracerConfig === undefined) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue