--- name: run-ansible-lint-role description: Run Ansible Lint on a role using our defaults. author: Michael Sasser branding: icon: shield color: blue inputs: args: description: Arguments to be passed to ansible-lint command. Defaults to '--show-relpath' required: false default: "--show-relpath" runs: using: composite steps: # Check if dependencies exist. - name: Check if the role has dependencies shell: bash id: get-role-dependencies run: | if test -f "${{ github.workspace }}/meta/requirements.yml"; then echo "The role has dependencies" echo '::set-output name=has_dependencies::true' else echo "The role does not have dependencies" echo '::set-output name=has_dependencies::false' fi # Run linter - name: Run ansible-lint (with dependencies) if: steps.get-role-dependencies.outputs.has_dependencies == 'true' uses: https://git.michaelsasser.org/actions/ansible-lint@main with: args: ${{ inputs.args }} requirements_file: ${{ github.workspace }}/meta/requirements.yml - name: Run ansible-lint (without dependencies) # same but without: requirements_file if: steps.get-role-dependencies.outputs.has_dependencies == 'false' uses: https://git.michaelsasser.org/actions/ansible-lint@main with: args: ${{ inputs.args }}