diff --git a/.github/workflows/manual-detached-test.yml b/.github/workflows/manual-detached-test.yml index a623483f..50751cea 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-seconds: 60 - run: | echo "A busy loop" for value in $(seq 10) diff --git a/action.yml b/action.yml index 8a691e7b..ee378345 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-seconds: + 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 diff --git a/lib/index.js b/lib/index.js index f69f26c6..e3287714 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-seconds")) + if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) { + connectTimeoutSeconds = 10 * 60 + } + + for (let seconds = connectTimeoutSeconds; seconds > 0; ) { console.log(`${ await hasAnyoneConnectedYet() ? 'Waiting for session to end' diff --git a/src/index.js b/src/index.js index 2b102b82..7c74b0a9 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-seconds")) + if (Number.isNaN(connectTimeoutSeconds) || connectTimeoutSeconds <= 0) { + connectTimeoutSeconds = 10 * 60 + } + + for (let seconds = connectTimeoutSeconds; seconds > 0; ) { console.log(`${ await hasAnyoneConnectedYet() ? 'Waiting for session to end'