Skip to content

Commit ac425ca

Browse files
committed
stop echoing tailscale status to console
Updates #201 Signed-off-by: Percy Wegmann <[email protected]>
1 parent 2976a88 commit ac425ca

File tree

4 files changed

+51
-29
lines changed

4 files changed

+51
-29
lines changed

dist/index.js

Lines changed: 15 additions & 7 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"license": "BSD-3-Clause",
1515
"dependencies": {
1616
"@actions/cache": "^4.0.0",
17-
"@actions/core": "^1.10.1",
17+
"@actions/core": "^1.10.1",
1818
"@actions/exec": "^1.1.1",
1919
"@actions/github": "^6.0.1",
2020
"@actions/tool-cache": "^2.0.1"
@@ -30,4 +30,4 @@
3030
"glob": "^10.3.10",
3131
"inflight": "npm:@isaacs/inflight@^1.0.6"
3232
}
33-
}
33+
}

src/main.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,21 @@ type tailscaleStatus = {
5858

5959
// Cross-platform Tailscale local API status check
6060
async function getTailscaleStatus(): Promise<tailscaleStatus> {
61-
const { stdout } = await exec.getExecOutput(cmdTailscale, [
62-
"status",
63-
"--json",
64-
]);
61+
const { exitCode, stdout, stderr } = await exec.getExecOutput(
62+
cmdTailscale,
63+
["status", "--json"],
64+
{
65+
silent: true,
66+
ignoreReturnCode: true,
67+
}
68+
);
69+
if (exitCode !== 0) {
70+
process.stderr.write(stderr);
71+
throw new Error(`tailscale status failed with exit code ${exitCode}`);
72+
}
73+
if (core.isDebug()) {
74+
process.stdout.write(stdout);
75+
}
6576
return JSON.parse(stdout);
6677
}
6778

@@ -110,7 +121,6 @@ async function run(): Promise<void> {
110121
// Check Tailscale status (cross-platform)
111122
try {
112123
const status = await getTailscaleStatus();
113-
core.debug(`Tailscale status: ${JSON.stringify(status)}`);
114124
if (status.BackendState === "Running") {
115125
core.info("✅ Tailscale is running and connected!");
116126
if (runnerOS === runnerMacOS) {
@@ -574,6 +584,7 @@ async function waitForDaemonReady(): Promise<void> {
574584

575585
core.info("Waiting for tailscaled daemon to become ready...");
576586

587+
var lastErr: any;
577588
while (waited < maxWaitMs) {
578589
try {
579590
const status = await getTailscaleStatus();
@@ -586,13 +597,16 @@ async function waitForDaemonReady(): Promise<void> {
586597
}
587598
} catch (err) {
588599
// Daemon not ready yet, keep polling
600+
lastErr = err;
589601
core.debug(`Waiting for daemon... (${waited}ms elapsed)`);
590602
}
591603
await sleep(pollIntervalMs);
592604
waited += pollIntervalMs;
593605
}
594606

595-
throw new Error("tailscaled daemon did not become ready within timeout");
607+
throw new Error(
608+
`tailscaled daemon did not become ready within timeout, last error: ${lastErr}`
609+
);
596610
}
597611

598612
async function connectToTailscale(

0 commit comments

Comments
 (0)