Skip to content

Commit

Permalink
feat: output redered target chart template (#156)
Browse files Browse the repository at this point in the history
* feat: output redered target chart template

* feat: build action
  • Loading branch information
KROSF authored Apr 26, 2024
1 parent dc631c1 commit 43bc515
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ inputs:
runs:
using: 'node20'
main: 'dist/index.js'

outputs:
changed:
description: 'Whether the charts are different'
diff:
description: 'The diff between the charts'
targetTemplate:
description: 'The target chart rendered with the target values'
12 changes: 12 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,16 @@ export const action = async (
}

output.setDiff(result.stdout)

const targetTemplate = await getExecOutput(
'helm',
['template', targetChartPath, '--values', targetValues],
{
ignoreReturnCode: true
}
)

if (targetTemplate.exitCode === 0) {
output.setTargetTemplate(targetTemplate.stdout)
}
}
7 changes: 7 additions & 0 deletions src/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ export class Output {
this.set('diff', diff)
this.set('changed', 'true')
}

setTargetTemplate(targetTemplate: string): void {
if (this.input.asMarkdown) {
targetTemplate = `\`\`\`yaml\n${targetTemplate}\n\`\`\``
}
this.set('targetTemplate', targetTemplate)
}
}

0 comments on commit 43bc515

Please sign in to comment.