Skip to content

Commit cad6165

Browse files
committed
Add ssh to output
1 parent f1ae249 commit cad6165

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ As this mode has turned out to be so useful as to having the potential for being
101101
When running in detached mode, the action sets the following outputs that can be used in subsequent steps or jobs:
102102

103103
- `ssh-command`: The SSH command to connect to the tmate session
104+
- `ssh-address`: The raw SSH address without the "ssh" prefix
104105
- `web-url`: The web URL to connect to the tmate session (if available)
105106

106107
Example workflow using the SSH command in another job:
@@ -113,6 +114,7 @@ jobs:
113114
runs-on: ubuntu-latest
114115
outputs:
115116
ssh-command: ${{ steps.tmate.outputs.ssh-command }}
117+
ssh-address: ${{ steps.tmate.outputs.ssh-address }}
116118
steps:
117119
- uses: actions/checkout@v4
118120
- name: Setup tmate session
@@ -127,8 +129,7 @@ jobs:
127129
steps:
128130
- name: Display SSH command
129131
run: |
130-
echo "Connect to the tmate session with:"
131-
echo ${{ needs.setup-tmate.outputs.ssh-command }}
132+
# Send a Slack message to someone telling them they can ssh to ${{ needs.setup-tmate.outputs.ssh-address }}
132133
```
133134

134135
## Without sudo

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,7 @@ inputs:
6060
outputs:
6161
ssh-command:
6262
description: 'The SSH command to connect to the tmate session (only set when detached mode is enabled)'
63+
ssh-address:
64+
description: 'The raw SSH address without the "ssh" prefix (only set when detached mode is enabled)'
6365
web-url:
6466
description: 'The web URL to connect to the tmate session (only set when detached mode is enabled and web URL is available)'

lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17605,6 +17605,8 @@ async function run() {
1760517605

1760617606
// Set the SSH command as an output so other jobs can use it
1760717607
core.setOutput('ssh-command', tmateSSH)
17608+
// Extract and set the raw SSH address (without the "ssh" prefix)
17609+
core.setOutput('ssh-address', tmateSSH.replace(/^ssh /, ''))
1760817610
if (tmateWeb) {
1760917611
core.setOutput('web-url', tmateWeb)
1761017612
}

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ export async function run() {
219219

220220
// Set the SSH command as an output so other jobs can use it
221221
core.setOutput('ssh-command', tmateSSH)
222+
// Extract and set the raw SSH address (without the "ssh" prefix)
223+
core.setOutput('ssh-address', tmateSSH.replace(/^ssh /, ''))
222224
if (tmateWeb) {
223225
core.setOutput('web-url', tmateWeb)
224226
}

0 commit comments

Comments
 (0)