name: Ansible Lint Check on: pull_request: push: branches: [ master ] jobs: check-ansible: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install Ansible and ansible-lint run: | python -m pip install --upgrade pip python -m pip install ansible ansible-lint - name: Run ansible-lint run: | if [ ! -d "config/ansible" ]; then echo "No ansible directory found at config/ansible" exit 0 fi found_files=$(find config/ansible -name "*.yml" -o -name "*.yaml") if [ -z "$found_files" ]; then echo "No Ansible files found in config/ansible to lint" exit 0 fi ansible-lint $found_files