Skip to content

Commit

Permalink
feat: output redered target chart template
Browse files Browse the repository at this point in the history
  • Loading branch information
KROSF committed Apr 26, 2024
1 parent dc631c1 commit 8c14e00
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
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 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 8c14e00

Please sign in to comment.