Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,77 @@ jobs:
- name: check stdout
run: |
echo "stdout: ${{ steps.stdout.outputs.stdout }}"
if [ -z "${{ steps.stdout.outputs.stdout }}" ]; then
echo "Error: stdout is empty"
exit 1
fi

- id: stdout-multiline
name: capture multiline output
uses: ./
with:
host: ${{ env.REMOTE_HOST }}
username: linuxserver.io
password: password
port: 2222
capture_stdout: true
script: |
#!/usr/bin/env bash
set -e
echo "Line 1"
echo "Line 2"
echo "Line 3"
whoami
pwd

- name: check multiline output
run: |
echo "stdout: ${{ steps.stdout-multiline.outputs.stdout }}"
# Check if all lines are present
if ! echo "${{ steps.stdout-multiline.outputs.stdout }}" | grep -q "Line 1"; then
echo "Error: 'Line 1' not found in output"
exit 1
fi
if ! echo "${{ steps.stdout-multiline.outputs.stdout }}" | grep -q "Line 2"; then
echo "Error: 'Line 2' not found in output"
exit 1
fi
if ! echo "${{ steps.stdout-multiline.outputs.stdout }}" | grep -q "Line 3"; then
echo "Error: 'Line 3' not found in output"
exit 1
fi
if ! echo "${{ steps.stdout-multiline.outputs.stdout }}" | grep -q "linuxserver.io"; then
echo "Error: username not found in output"
exit 1
fi
Comment on lines +635 to +654
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test that explicitly verifies the output is not duplicated. Since this PR fixes issue #397 about duplicated output, it would be valuable to have a test that counts the occurrences of specific output lines to ensure they appear exactly once, not twice. For example, you could check that "Line 1" appears exactly once in the multiline output test.

Copilot uses AI. Check for mistakes.

- id: stdout-with-special-chars
name: capture output with special characters
uses: ./
with:
host: ${{ env.REMOTE_HOST }}
username: linuxserver.io
password: password
port: 2222
capture_stdout: true
script: |
#!/usr/bin/env bash
set -e
echo "Test with special chars: @#$%^&*()"
echo "Path: /home/user/test"
echo "JSON: {\"key\": \"value\"}"

- name: check special characters output
run: |
echo "stdout: ${{ steps.stdout-with-special-chars.outputs.stdout }}"
if ! echo "${{ steps.stdout-with-special-chars.outputs.stdout }}" | grep -q "special chars"; then
echo "Error: special characters test failed"
exit 1
fi
if ! echo "${{ steps.stdout-with-special-chars.outputs.stdout }}" | grep -q "/home/user/test"; then
echo "Error: path not found in output"
exit 1
fi
Comment on lines +697 to +707
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test verifies special characters and file paths but doesn't verify the JSON output line. Consider adding a check to ensure the JSON line with escaped quotes is captured correctly, as this is an important edge case for validating special character handling.

Copilot uses AI. Check for mistakes.

testing-script-stop:
runs-on: ubuntu-latest
Expand Down
8 changes: 3 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ if ! "${TARGET}" --version; then
fi
echo "======================================="
if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
{
echo 'stdout<<EOF'
"${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
echo 'EOF'
} >>"${GITHUB_OUTPUT}"
echo 'stdout<<EOF' >> "${GITHUB_OUTPUT}"
"${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
echo 'EOF' >> "${GITHUB_OUTPUT}"
else
"${TARGET}" "$@"
fi
Loading