Send the version and mode with the user agent

This commit changes the way the action determines if running in action
or runner mode. There is now an environment variable that is set at the
beginning of the process and elsewhere in the process, we can check to
see if the variable is set.
This commit is contained in:
Andrew Eisenberg 2021-05-20 15:20:32 -07:00
parent fad7cc482d
commit 47588796b4
48 changed files with 361 additions and 224 deletions

4
lib/api-client.js generated
View file

@ -15,6 +15,8 @@ const githubUtils = __importStar(require("@actions/github/lib/utils"));
const console_log_level_1 = __importDefault(require("console-log-level"));
const actions_util_1 = require("./actions-util");
const util_1 = require("./util");
// eslint-disable-next-line import/no-commonjs
const pkg = require("../package.json");
var DisallowedAPIVersionReason;
(function (DisallowedAPIVersionReason) {
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_OLD"] = 0] = "ACTION_TOO_OLD";
@ -27,7 +29,7 @@ exports.getApiClient = function (apiDetails, { allowLocalRun = false, allowExter
const auth = (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
return new githubUtils.GitHub(githubUtils.getOctokitOptions(auth, {
baseUrl: getApiUrl(apiDetails.url),
userAgent: "CodeQL Action",
userAgent: `CodeQL ${actions_util_1.getMode()}/${pkg.version}`,
log: console_log_level_1.default({ level: "debug" }),
}));
};