---
name: Lint

on:
  push:
    branches: [main, development]
  pull_request:
    branches: [main]

jobs:
  yaml-lint:
    name: YAML Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install yamllint
        run: pip install yamllint

      - name: Run yamllint
        run: yamllint .

  ansible-lint:
    name: Ansible Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          pip install ansible ansible-lint

      - name: Install Ansible collections
        run: ansible-galaxy collection install -r requirements.yml

      - name: Run ansible-lint
        run: ansible-lint playbook.yml

  syntax-check:
    name: Ansible Syntax Check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install Ansible
        run: pip install ansible

      - name: Install Ansible collections
        run: ansible-galaxy collection install -r requirements.yml

      - name: Ansible syntax check
        run: ansible-playbook playbook.yml --syntax-check
