Skip to content

Commit

Permalink
ci: standardize naming and validation of stdout steps
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
appleboy committed Dec 5, 2024
1 parent 903686e commit fa25e30
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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

0 comments on commit fa25e30

Please sign in to comment.