---
name: setup-actionlint
description: Setup actionlint
inputs:
  version:
    description: The version of actionlint
    default: 1.6.25

runs:
  using: composite
  steps:

    - name: Cache actionlint Binary
      uses: actions/cache@v4
      with:
        path: /usr/local/bin/actionlint
        key: ${{ runner.os }}|${{ runner.arch }}|actionlint|${{ inputs.version }}

    - name: Setup actionlint
      shell: bash
      run: |
        if ! command -v actionlint; then
          bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) ${{ inputs.version }}
          mv ./actionlint /usr/local/bin/actionlint
        fi
    - name: Show actionlint Version
      shell: bash
      run: |
        actionlint --version
