Add environment variables to signal feature and version to the CLI
This PR ensures environment variables are set before any invocation of the CLI. Here is a list of vars that are set: https://github.com/github/codeql-coreql-team/issues/1124#issuecomment-852463521 This ensures the CLI knows the features and versions of the containing actions/runner. Additionally: - Fix the user agent so that it more closely aligns with user agent spec - Refactor environment variable initialization so that it all happens in one place and call. - Move Mode, getRequiredEnvParam, setMode, getMode out of actions-util and into util. actions-util is meant for utils only called by the action, not the runner. The `prepareLocalRunEnvironment()` method is most likely deprecated and should be removed. I originally added it because I had a way of working where I would run the action from my local machine to test out changes, but this was always a little flaky. So, I no longer use this way of working. I will probably remove it soon.
This commit is contained in:
parent
539d968ad7
commit
3708898bf2
48 changed files with 387 additions and 250 deletions
|
|
@ -3,8 +3,8 @@ import * as path from "path";
|
|||
import * as githubUtils from "@actions/github/lib/utils";
|
||||
import consoleLogLevel from "console-log-level";
|
||||
|
||||
import { getMode, getRequiredEnvParam, getRequiredInput } from "./actions-util";
|
||||
import { isLocalRun } from "./util";
|
||||
import { getRequiredInput } from "./actions-util";
|
||||
import { getMode, getRequiredEnvParam, isLocalRun } from "./util";
|
||||
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
const pkg = require("../package.json");
|
||||
|
|
@ -40,7 +40,7 @@ export const getApiClient = function (
|
|||
return new githubUtils.GitHub(
|
||||
githubUtils.getOctokitOptions(auth, {
|
||||
baseUrl: getApiUrl(apiDetails.url),
|
||||
userAgent: `CodeQL ${getMode()}/${pkg.version}`,
|
||||
userAgent: `CodeQL-${getMode()}/${pkg.version}`,
|
||||
log: consoleLogLevel({ level: "debug" }),
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue