Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13591,14 +13591,19 @@ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

async function run() {
try {
// Enable debug logging by default
(external_process_default()).env.ACTIONS_STEP_DEBUG = "true";
core.info("running test/tmate-verbose")
core.debug("Debug logging enabled by default");

/* Indicates whether the POST action is running */
if (!!core.getState('isPost')) {
const message = core.getState('message')
const tmate = core.getState('tmate')
if (tmate && message) {
const shutdown = async () => {
core.error('Got signal')
await execShellCommand(`${tmate} kill-session`)
await execShellCommand(`${tmate} -vv kill-session`)
external_process_default().exit(1)
}
// This is needed to fully support canceling the post-job Action, for details see
Expand All @@ -13611,7 +13616,7 @@ async function run() {
return async () => {
return result ||=
!didTmateQuit()
&& '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true })
&& '0' !== await execShellCommand(`${tmate} -vv display -p '#{tmate_num_clients}'`, { quiet: true })
}
})()

Expand Down Expand Up @@ -13740,15 +13745,15 @@ async function run() {
}

core.debug("Creating new session")
await execShellCommand(`${tmate} ${newSessionExtra} ${setDefaultCommand} new-session -d`);
await execShellCommand(`${tmate} wait tmate-ready`);
await execShellCommand(`${tmate} -vv ${newSessionExtra} ${setDefaultCommand} new-session -d`);
await execShellCommand(`${tmate} -vv wait tmate-ready`);
core.debug("Created new session successfully")

core.debug("Fetching connection strings")
const tmateSSH = await execShellCommand(`${tmate} display -p '#{tmate_ssh}'`);
const tmateSSH = await execShellCommand(`${tmate} -vv display -p '#{tmate_ssh}'`);
const [, , tokenHost] = tmateSSH.split(" ");
const [token,] = tokenHost.split("@")
const tmateWeb = await execShellCommand(`${tmate} display -p '#{tmate_web}'`);
const tmateWeb = await execShellCommand(`${tmate} -vv display -p '#{tmate_web}'`);

/*
* Publish a variable so that when the POST action runs, it can determine
Expand Down
17 changes: 11 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

export async function run() {
try {
// Enable debug logging by default
process.env.ACTIONS_STEP_DEBUG = "true";
core.info("running test/tmate-verbose")
core.debug("Debug logging enabled by default");

/* Indicates whether the POST action is running */
if (!!core.getState('isPost')) {
const message = core.getState('message')
const tmate = core.getState('tmate')
if (tmate && message) {
const shutdown = async () => {
core.error('Got signal')
await execShellCommand(`${tmate} kill-session`)
await execShellCommand(`${tmate} -vv kill-session`)
process.exit(1)
}
// This is needed to fully support canceling the post-job Action, for details see
Expand All @@ -50,7 +55,7 @@ export async function run() {
return async () => {
return result ||=
!didTmateQuit()
&& '0' !== await execShellCommand(`${tmate} display -p '#{tmate_num_clients}'`, { quiet: true })
&& '0' !== await execShellCommand(`${tmate} -vv display -p '#{tmate_num_clients}'`, { quiet: true })
}
})()

Expand Down Expand Up @@ -179,15 +184,15 @@ export async function run() {
}

core.debug("Creating new session")
await execShellCommand(`${tmate} ${newSessionExtra} ${setDefaultCommand} new-session -d`);
await execShellCommand(`${tmate} wait tmate-ready`);
await execShellCommand(`${tmate} -vv ${newSessionExtra} ${setDefaultCommand} new-session -d`);
await execShellCommand(`${tmate} -vv wait tmate-ready`);
core.debug("Created new session successfully")

core.debug("Fetching connection strings")
const tmateSSH = await execShellCommand(`${tmate} display -p '#{tmate_ssh}'`);
const tmateSSH = await execShellCommand(`${tmate} -vv display -p '#{tmate_ssh}'`);
const [, , tokenHost] = tmateSSH.split(" ");
const [token,] = tokenHost.split("@")
const tmateWeb = await execShellCommand(`${tmate} display -p '#{tmate_web}'`);
const tmateWeb = await execShellCommand(`${tmate} -vv display -p '#{tmate_web}'`);

/*
* Publish a variable so that when the POST action runs, it can determine
Expand Down