- Add documentation outlining usage of output variables, specifically the captured command standard output
- Introduce the `capture_stdout` parameter to command options tables
- Update Quick Start examples to use a secret for the username, and clarify output handling
- Provide example workflows showing how to capture and use command output in subsequent steps
- Change code block language from bash to text for SSH configuration snippets
Signed-off-by: appleboy <appleboy.tw@gmail.com>
On Ubuntu 20.04+ you may need to explicitly allow the `ssh-rsa` algorithm. Add this to your OpenSSH daemon config (`/etc/ssh/sshd_config` or a drop-in under `/etc/ssh/sshd_config.d/`):
```bash
```text
CASignatureAlgorithms +ssh-rsa
```
@ -366,6 +379,28 @@ Default `port` is `22`.
> _All environment variables in the `env` object must be strings. Using integers or other types may cause unexpected results._
### Capturing command output
You can capture the standard output of remote commands and use it in subsequent steps:
```yaml
- name: Execute and capture output
id: ssh
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
capture_stdout: true
script: |
echo "Hello World"
hostname
- name: Use captured output
run: echo "SSH output was ${{ steps.ssh.outputs.stdout }}"
```
---
## 🌐 Proxy & Jump Host Usage
@ -380,7 +415,7 @@ You can connect to remote hosts via a proxy (jump host) for advanced network top