1
0
Fork 0
mirror of synced 2026-06-05 14:25:14 +00:00

Address Copilot review: cache isDocker/isAgentInstalled calls, rename test file

Compute isDocker() and isAgentInstalled() once and reuse for both
the deploy check and logging. Rename setup.test.ts to utils.test.ts
to match the module it tests.
This commit is contained in:
Varun Sharma 2026-04-12 20:58:46 -07:00
commit bb4b9e732d
4 changed files with 12 additions and 7 deletions

8
dist/pre/index.js vendored
View file

@ -85900,7 +85900,9 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
encoding: "utf8",
});
lib_core.info(SELF_HOSTED_RUNNER_MESSAGE);
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, isDocker(), isAgentInstalled(process.platform))) {
const inContainer = isDocker();
const alreadyInstalled = isAgentInstalled(process.platform);
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, inContainer, alreadyInstalled)) {
if (process.platform !== "linux") {
lib_core.info("deploy-on-self-hosted-vm is only supported on Linux. Skipping agent deployment.");
}
@ -85910,10 +85912,10 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
}
}
else {
if (confg.deploy_on_self_hosted_vm && isDocker()) {
if (confg.deploy_on_self_hosted_vm && inContainer) {
lib_core.info("Skipping agent deployment: running inside a container.");
}
if (confg.deploy_on_self_hosted_vm && isAgentInstalled(process.platform)) {
if (confg.deploy_on_self_hosted_vm && alreadyInstalled) {
lib_core.info("Agent already installed on self-hosted runner, skipping installation.");
}
}

File diff suppressed because one or more lines are too long

View file

@ -295,7 +295,10 @@ interface MonitorResponse {
core.info(common.SELF_HOSTED_RUNNER_MESSAGE);
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, isDocker(), isAgentInstalled(process.platform))) {
const inContainer = isDocker();
const alreadyInstalled = isAgentInstalled(process.platform);
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, inContainer, alreadyInstalled)) {
if (process.platform !== "linux") {
core.info("deploy-on-self-hosted-vm is only supported on Linux. Skipping agent deployment.");
} else {
@ -303,10 +306,10 @@ interface MonitorResponse {
await installAgentForSelfHosted(context.repo.owner, confg);
}
} else {
if (confg.deploy_on_self_hosted_vm && isDocker()) {
if (confg.deploy_on_self_hosted_vm && inContainer) {
core.info("Skipping agent deployment: running inside a container.");
}
if (confg.deploy_on_self_hosted_vm && isAgentInstalled(process.platform)) {
if (confg.deploy_on_self_hosted_vm && alreadyInstalled) {
core.info("Agent already installed on self-hosted runner, skipping installation.");
}
}