2 Commits

Author SHA1 Message Date
Bo-Yi Wu
49751ff516 docs: standardize script_file naming to script_path in documentation (#360)
- Rename `script_file` to `script_path` in README.md
- Rename `script_file` to `script_path` in README.zh-cn.md
- Rename `script_file` to `script_path` in README.zh-tw.md

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-01-03 10:17:01 +08:00
Bo-Yi Wu
86aa40ddb7 ci: add SSH server testing to GitHub Actions workflow
- Add a new job `testing-script-error` to the GitHub Actions workflow
- Use `actions/checkout@v4` to check out the code
- Create and run a new SSH server container using `lscr.io/linuxserver/openssh-server:latest`
- Capture the container's IP address and set it as an environment variable
- Add a step to test script errors with `continue-on-error: true`
- Configure the test script to connect to the SSH server and run a command that will fail (`ls /nonexistent`)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2025-01-03 09:31:39 +08:00
4 changed files with 44 additions and 3 deletions

View File

@@ -681,3 +681,44 @@ jobs:
if echo "${{ steps.stdout02.outputs.stdout }}" | grep -q "True"; then if echo "${{ steps.stdout02.outputs.stdout }}" | grep -q "True"; then
echo "Output contains 'True'" echo "Output contains 'True'"
fi fi
testing-script-error:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: create new ssh server
run: |
docker run -d \
--name=openssh-server \
--hostname=openssh-server \
-p 2222:2222 \
-e SUDO_ACCESS=false \
-e PASSWORD_ACCESS=true \
-e USER_PASSWORD=password \
-e USER_NAME=linuxserver.io \
--restart unless-stopped \
lscr.io/linuxserver/openssh-server:latest
docker exec openssh-server sh -c "hostname -i" > ip.txt
echo "REMOTE_HOST<<EOF" >> $GITHUB_ENV
cat ip.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "======= container ip address ========="
cat ip.txt
echo "======================================"
sleep 2
- name: test script error
uses: ./
continue-on-error: true
with:
host: ${{ env.REMOTE_HOST }}
username: linuxserver.io
password: password
port: 2222
capture_stdout: true
script: |
#!/usr/bin/env bash
set -e
ls /nonexistent

View File

@@ -43,7 +43,7 @@ See [action.yml](./action.yml) for more detailed information.
| proxy_cipher | Allowed cipher algorithms for the proxy | | | proxy_cipher | Allowed cipher algorithms for the proxy | |
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false | | proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false |
| script | Execute commands | | | script | Execute commands | |
| script_file | Execute commands from a file | | | script_path | Execute commands from a file | |
| envs | Pass environment variables to shell script | | | envs | Pass environment variables to shell script | |
| envs_format | Flexible configuration of environment value transfer | | | envs_format | Flexible configuration of environment value transfer | |
| debug | Enable debug mode | false | | debug | Enable debug mode | false |

View File

@@ -43,7 +43,7 @@
| proxy_cipher | 代理允许的密码算法 | | | proxy_cipher | 代理允许的密码算法 | |
| proxy_use_insecure_cipher | 使用不安全的密码算法 | false | | proxy_use_insecure_cipher | 使用不安全的密码算法 | false |
| script | 执行命令 | | | script | 执行命令 | |
| script_file | 从文件执行命令 | | | script_path | 从文件执行命令 | |
| envs | 传递环境变量到 shell 脚本 | | | envs | 传递环境变量到 shell 脚本 | |
| envs_format | 环境变量传递的灵活配置 | | | envs_format | 环境变量传递的灵活配置 | |
| debug | 启用调试模式 | false | | debug | 启用调试模式 | false |

View File

@@ -43,7 +43,7 @@
| proxy_cipher | 代理允許的加密算法 | | | proxy_cipher | 代理允許的加密算法 | |
| proxy_use_insecure_cipher | 包含更多不安全的加密算法 | false | | proxy_use_insecure_cipher | 包含更多不安全的加密算法 | false |
| script | 執行命令 | | | script | 執行命令 | |
| script_file | 從文件中執行命令 | | | script_path | 從文件中執行命令 | |
| envs | 將環境變數傳遞給 shell 腳本 | | | envs | 將環境變數傳遞給 shell 腳本 | |
| envs_format | 環境值傳遞的靈活配置 | | | envs_format | 環境值傳遞的靈活配置 | |
| debug | 啟用調試模式 | false | | debug | 啟用調試模式 | false |