Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the output of helmfile to the action outputs #154

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
outputs:
exit-code:
description: 'Exit code of helmfile. Useful to handle diff --detailed-exitcode'
helmfile-output:
description: 'Output of helmfile diff'
helmfile-error:
description: 'Error of helmfile'
runs:
using: 'node16'
main: 'dist/index.js'
14 changes: 14 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,21 @@ async function run(): Promise<void> {
options
);

let helmfileOutput = '';
let helmfileError = '';
Copy link

Choose a reason for hiding this comment

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

I would personally call these two as helmfileStdout and helmfileStderr respectively.


options.listeners = {
stdout: (data: Buffer) => {
helmfileOutput += data.toString();
},
stderr: (data: Buffer) => {
helmfileError += data.toString();
}
};

core.setOutput('exit-code', processExitCode);
core.setOutput('helmfile-output', helmfileOutput);
core.setOutput('helmfile-error', helmfileError);

if (processExitCode !== 0 && processExitCode !== 2) {
throw new Error(
Expand Down