Skip to content

fix: use getExecOutput() and set outputs in finally block - #699

Merged
yxxhero merged 1 commit into
mainfrom
fix/empty-outputs-218
May 17, 2026
Merged

fix: use getExecOutput() and set outputs in finally block#699
yxxhero merged 1 commit into
mainfrom
fix/empty-outputs-218

Conversation

@yxxhero

@yxxhero yxxhero commented May 17, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #218

  • Replace manual listeners with getExecOutput() from @actions/exec, which uses StringDecoder to properly handle multi-byte character splits across Buffer boundaries (e.g. ANSI color codes from helm-diff output)
  • Move setOutput calls to a finally block so that exit-code, helmfile-stdout, and helmfile-stderr are always set — even when the command fails to spawn or throws unexpectedly

How to test

- name: Run helmfile
  id: helmfile_diff
  uses: helmfile/helmfile-action@fix/empty-outputs-218
  with:
    helmfile-args: diff --environment staging
- name: Check outputs
  run: |
    echo "exit-code: ${{ steps.helmfile_diff.outputs.exit-code }}"
    echo "stdout length: $(echo '${{ steps.helmfile_diff.outputs.helmfile-stdout }}' | wc -c)"
    echo "stderr length: $(echo '${{ steps.helmfile_diff.outputs.helmfile-stderr }}' | wc -c)"

Replace manual listeners with getExecOutput() to properly handle
multi-byte character splits across buffers (e.g. ANSI color codes
from helm-diff). Move setOutput calls to finally block so outputs
are always set, even when the command fails to spawn.

Fixes #218

Signed-off-by: yxxhero <aiopsclub@163.com>
@yxxhero
yxxhero merged commit 6331a68 into main May 17, 2026
12 checks passed
@yxxhero
yxxhero deleted the fix/empty-outputs-218 branch May 17, 2026 01:02
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.

All outputs are empty?

1 participant