Skip to content

Conversation

@appleboy
Copy link
Owner

  • Write the stdout<<EOF and EOF markers directly to GITHUB_OUTPUT instead of using a group command
  • Simplify the process for capturing and appending command output to GITHUB_OUTPUT
  • Add a check to ensure captured stdout is not empty
  • Add steps to capture and verify multiline stdout output
  • Add verification that specific lines and the username are present in captured output
  • Add steps to handle and verify stdout containing special characters and file paths

fix #403
fix #397

Signed-off-by: appleboy appleboy.tw@gmail.com

- Write the stdout<<EOF and EOF markers directly to GITHUB_OUTPUT instead of using a group command
- Simplify the process for capturing and appending command output to GITHUB_OUTPUT

fix #403
fix #397

Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add a check to ensure captured stdout is not empty
- Add steps to capture and verify multiline stdout output
- Add verification that specific lines and the username are present in captured output
- Add steps to handle and verify stdout containing special characters and file paths

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Copilot AI review requested due to automatic review settings January 28, 2026 01:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug where stdout was being duplicated when capture_stdout: true was enabled. The issue was introduced in a previous refactoring that wrapped the output capture logic in a subshell, causing the output to be written twice to GITHUB_OUTPUT.

Changes:

  • Removed the subshell wrapper in entrypoint.sh that was causing output duplication
  • Added comprehensive tests to verify stdout capture works correctly with empty checks, multiline output, and special characters

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
entrypoint.sh Simplified stdout capture by removing the problematic subshell and writing delimiters directly to GITHUB_OUTPUT
.github/workflows/main.yml Added three new test cases to validate stdout capture functionality: empty output check, multiline output verification, and special characters handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +672 to +682
- 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
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.
Comment on lines +635 to +654
- 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
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.
- Add a step to verify that lines "Line 1", "Line 2", and "Line 3" each appear exactly once in the multiline output
- Fail the workflow if any line is missing or duplicated
- Confirm successful validation with a message when no duplicates are found

Signed-off-by: appleboy <appleboy.tw@gmail.com>
@appleboy appleboy merged commit 0ff4204 into master Jan 28, 2026
28 of 30 checks passed
@appleboy appleboy deleted the github branch January 28, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicated output capture on the latest (1.2.3) version.

1 participant