mirror of
https://github.com/appleboy/ssh-action.git
synced 2025-04-07 19:21:59 +00:00
ci: standardize naming and validation of stdout steps
- Rename `stdout` step to `stdout01` in the GitHub Actions workflow - Rename `check stdout` step to `check stdout 01` - Update references to `stdout` to `stdout01` in echo and grep commands - Add a new step `stdout02` for SSH command execution with stdout capture - Add a new step `check stdout 02` to validate the output of `stdout02` step Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
903686e51b
commit
fa25e303db
1 changed files with 36 additions and 6 deletions
42
.github/workflows/main.yml
vendored
42
.github/workflows/main.yml
vendored
|
@ -622,8 +622,8 @@ jobs:
|
|||
echo "======================================"
|
||||
sleep 2
|
||||
|
||||
- id: stdout
|
||||
name: ssh command with stdout
|
||||
- id: stdout01
|
||||
name: ssh command with stdout 01
|
||||
uses: ./
|
||||
with:
|
||||
host: ${{ env.REMOTE_HOST }}
|
||||
|
@ -641,13 +641,43 @@ jobs:
|
|||
echo "False"
|
||||
fi
|
||||
|
||||
- name: check stdout
|
||||
- name: check stdout 01
|
||||
run: |
|
||||
echo "stdout: ${{ steps.stdout.outputs.stdout }}"
|
||||
if echo "${{ steps.stdout.outputs.stdout }}" | grep -q "True"; then
|
||||
echo "stdout: ${{ steps.stdout01.outputs.stdout }}"
|
||||
if echo "${{ steps.stdout01.outputs.stdout }}" | grep -q "True"; then
|
||||
echo "Output contains 'True'"
|
||||
exit 1
|
||||
fi
|
||||
if echo "${{ steps.stdout.outputs.stdout }}" | grep -q "False"; then
|
||||
if echo "${{ steps.stdout01.outputs.stdout }}" | grep -q "False"; then
|
||||
echo "Output contains 'False'"
|
||||
fi
|
||||
|
||||
- id: stdout02
|
||||
name: ssh command with stdout 01
|
||||
uses: ./
|
||||
with:
|
||||
host: ${{ env.REMOTE_HOST }}
|
||||
username: linuxserver.io
|
||||
password: password
|
||||
port: 2222
|
||||
capture_stdout: true
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo "TMP TESTING IF"
|
||||
if [[ "1" == "1" ]]; then
|
||||
echo "True"
|
||||
else
|
||||
echo "False"
|
||||
fi
|
||||
|
||||
- name: check stdout 02
|
||||
run: |
|
||||
echo "stdout: ${{ steps.stdout02.outputs.stdout }}"
|
||||
if echo "${{ steps.stdout02.outputs.stdout }}" | grep -q "False"; then
|
||||
echo "Output contains 'False'"
|
||||
exit 1
|
||||
fi
|
||||
if echo "${{ steps.stdout02.outputs.stdout }}" | grep -q "True"; then
|
||||
echo "Output contains 'True'"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue