Set the CODEQL_WRAPPER env var

The CODEQL_WRAPPER environment variable will be set to "action" if
running in an actions context and "runner" otherwise. This variable
will be used in the cli to determine which context it is in.

Also, use a similar mechanism to provide a different user agent
when communicating with the github api.
This commit is contained in:
Andrew Eisenberg
2021-05-10 14:13:22 -07:00
parent 224195bd22
commit ea8a6c7048
12 changed files with 41 additions and 7 deletions

2
lib/codeql.js generated
View File

@@ -216,6 +216,8 @@ async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, mode, v
else if (process.platform !== "linux" && process.platform !== "darwin") {
throw new Error(`Unsupported platform: ${process.platform}`);
}
// set a environment variable to let CodeQL know where we are running
process.env.CODEQL_WRAPPER = util.isAction() ? "action" : "runner";
cachedCodeQL = getCodeQLForCmd(codeqlCmd);
return { codeql: cachedCodeQL, toolsVersion: codeqlURLVersion };
}