From 5f7991169d14f511fcb6c26a203092fc32015c54 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 11 Apr 2024 13:51:03 -0400 Subject: [PATCH 1/4] add connect-timeout variable Signed-off-by: Dave Lee --- .github/workflows/manual-detached-test.yml | 1 + src/index.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/manual-detached-test.yml b/.github/workflows/manual-detached-test.yml index a623483f..fd084c46 100644 --- a/.github/workflows/manual-detached-test.yml +++ b/.github/workflows/manual-detached-test.yml @@ -10,6 +10,7 @@ jobs: with: limit-access-to-actor: true detached: true + connect-timeout: 60 - run: | echo "A busy loop" for value in $(seq 10) diff --git a/src/index.js b/src/index.js index 2b102b82..ec918536 100644 --- a/src/index.js +++ b/src/index.js @@ -49,7 +49,13 @@ export async function run() { && '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true }) } })() - for (let seconds = 10 * 60; seconds > 0; ) { + + let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout")) + if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) { + connectTimeoutSeconds = 10 * 60 + } + + for (let seconds = connectTimeoutSeconds; seconds > 0; ) { console.log(`${ await hasAnyoneConnectedYet() ? 'Waiting for session to end' From 4d73cfda2d1ce96fcb4b67ef36c7b495e220dd72 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 11 Apr 2024 13:54:29 -0400 Subject: [PATCH 2/4] run the build Signed-off-by: Dave Lee --- lib/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index f69f26c6..1b3db339 100644 --- a/lib/index.js +++ b/lib/index.js @@ -17435,7 +17435,13 @@ async function run() { && '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true }) } })() - for (let seconds = 10 * 60; seconds > 0; ) { + + let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout")) + if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) { + connectTimeoutSeconds = 10 * 60 + } + + for (let seconds = connectTimeoutSeconds; seconds > 0; ) { console.log(`${ await hasAnyoneConnectedYet() ? 'Waiting for session to end' From 90ffb18ca9ccdf1a34f30c195cfc0cc708e71626 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 11 Apr 2024 13:57:54 -0400 Subject: [PATCH 3/4] action.yml Signed-off-by: Dave Lee --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 8a691e7b..3dc5115f 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,10 @@ inputs: description: 'In detached mode, the workflow job will continue while the tmate session is active' required: false default: 'false' + connect-timeout: + description: 'How long in seconds to wait for a connection to be established' + required: false + default: '600' tmate-server-host: description: 'The hostname for your tmate server (e.g. ssh.example.org)' required: false From 7cf1b970afe36fd163eba2e1b6041f7e5056e312 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Fri, 12 Apr 2024 09:49:22 -0400 Subject: [PATCH 4/4] connect-timeout-seconds is a better name Signed-off-by: Dave Lee --- .github/workflows/manual-detached-test.yml | 2 +- action.yml | 2 +- lib/index.js | 2 +- src/index.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/manual-detached-test.yml b/.github/workflows/manual-detached-test.yml index fd084c46..50751cea 100644 --- a/.github/workflows/manual-detached-test.yml +++ b/.github/workflows/manual-detached-test.yml @@ -10,7 +10,7 @@ jobs: with: limit-access-to-actor: true detached: true - connect-timeout: 60 + connect-timeout-seconds: 60 - run: | echo "A busy loop" for value in $(seq 10) diff --git a/action.yml b/action.yml index 3dc5115f..ee378345 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,7 @@ inputs: description: 'In detached mode, the workflow job will continue while the tmate session is active' required: false default: 'false' - connect-timeout: + connect-timeout-seconds: description: 'How long in seconds to wait for a connection to be established' required: false default: '600' diff --git a/lib/index.js b/lib/index.js index 1b3db339..e3287714 100644 --- a/lib/index.js +++ b/lib/index.js @@ -17436,7 +17436,7 @@ async function run() { } })() - let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout")) + let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout-seconds")) if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) { connectTimeoutSeconds = 10 * 60 } diff --git a/src/index.js b/src/index.js index ec918536..7c74b0a9 100644 --- a/src/index.js +++ b/src/index.js @@ -50,7 +50,7 @@ export async function run() { } })() - let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout")) + let connectTimeoutSeconds = parseInt(core.getInput("connect-timeout-seconds")) if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) { connectTimeoutSeconds = 10 * 60 }