name: yq-trim
description: "Change the language format of a file."
inputs:
  input:
    description: "Left-hand side of merge."
    required: true
  recursive:
    description: "Recursivevly trim the input. Default: true"
    required: true
    default: "true"
  tmpDir:
    description: "Temporary directory. Default: _tmp"
    required: true
    default: _tmp
outputs:
  result:
    description: "The converted file."
    value: ${{ steps.trim.outputs.console }}
runs:
  using: "composite"
  steps:
  - name: "Make temporary file of input."
    id: input
    uses: act/common/utils/mktemp@master
    with:
      input: ${{ inputs.input }}
      tmpDir: ${{ inputs.tmpDir }}
  - name: "Make temporary file of script."
    id: script
    uses: act/common/utils/mktemp@master
    with:
      input: ${{ github.action_path }}/trim.sh
      tmpDir: .
  - name: "Run script."
    id: trim
    uses: act/common/yq/yq@master
    with:
      program: bash
      command: ${{ steps.script.outputs.tmp }} ${{ steps.input.outputs.tmp }} ${{ inputs.recursive }}
  - name: "Remove temporary files."
    run: |
      rm "${{ steps.script.outputs.tmp }}"
      rm -rf "${{ inputs.tmpDir }}"
    shell: bash
