From fa25e303db452f226130222a7d8a828aaa087452 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Thu, 5 Dec 2024 16:18:06 +0800 Subject: [PATCH] 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 --- .github/workflows/main.yml | 42 ++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4a778f..3d51589 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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