@@ -25686,6 +25686,8 @@ var __importStar = (this && this.__importStar) || (function () {
2568625686Object.defineProperty(exports, "__esModule", ({ value: true }));
2568725687const core = __importStar(__nccwpck_require__(7484));
2568825688const exec = __importStar(__nccwpck_require__(5236));
25689+ const fs = __importStar(__nccwpck_require__(9896));
25690+ const runnerWindows = "Windows";
2568925691async function logout() {
2569025692 try {
2569125693 const runnerOS = process.env.RUNNER_OS || "";
@@ -25703,29 +25705,43 @@ async function logout() {
2570325705 // Check if tailscale is available first
2570425706 try {
2570525707 await exec.exec("tailscale", ["--version"], { silent: true });
25708+ // Determine the correct command based on OS
25709+ let execArgs;
25710+ if (runnerOS === runnerWindows) {
25711+ execArgs = ["tailscale", "logout"];
25712+ }
25713+ else {
25714+ // Linux and macOS - use system-installed binary with sudo
25715+ execArgs = ["sudo", "-E", "tailscale", "logout"];
25716+ }
25717+ core.info(`Running: ${execArgs.join(" ")}`);
25718+ try {
25719+ await exec.exec(execArgs[0], execArgs.slice(1));
25720+ core.info("✅ Successfully logged out of Tailscale");
25721+ }
25722+ catch (error) {
25723+ // Don't fail the action if logout fails - it's just cleanup
25724+ core.warning(`Failed to logout from Tailscale: ${error}`);
25725+ core.info("Your ephemeral node will eventually be cleaned up by Tailscale");
25726+ }
2570625727 }
2570725728 catch (error) {
2570825729 core.info("Tailscale not found or not accessible, skipping logout");
2570925730 return;
2571025731 }
25711- // Determine the correct command based on OS
25712- let execArgs;
25713- if (runnerOS === "Windows") {
25714- execArgs = ["tailscale", "logout"];
25715- }
25716- else {
25717- // Linux and macOS - use system-installed binary with sudo
25718- execArgs = ["sudo", "-E", "tailscale", "logout"];
25719- }
25720- core.info(`Running: ${execArgs.join(" ")}`);
25721- try {
25722- await exec.exec(execArgs[0], execArgs.slice(1));
25723- core.info("✅ Successfully logged out of Tailscale");
25724- }
25725- catch (error) {
25726- // Don't fail the action if logout fails - it's just cleanup
25727- core.warning(`Failed to logout from Tailscale: ${error}`);
25728- core.info("Your ephemeral node will eventually be cleaned up by Tailscale");
25732+ if (runnerOS !== runnerWindows) {
25733+ try {
25734+ core.info("Stopping tailscaled");
25735+ const pid = fs.readFileSync("tailscaled.pid").toString();
25736+ if (pid === "") {
25737+ throw new Error("pid file empty");
25738+ }
25739+ await exec.exec("sudo", ["kill", "-9", pid]);
25740+ core.info("✅ Stopped tailscaled");
25741+ }
25742+ catch (error) {
25743+ core.warning(`Failed to stop tailscaled: ${error}`);
25744+ }
2572925745 }
2573025746 }
2573125747 catch (error) {
0 commit comments