1
0
Fork 0
forked from infra/ansible
ansible/.forgejo/workflows/ci.yaml
Michal Konecny 27e3392a20 Improve ansible-lint
Why ignore the hardcoded paths, let's just create symlink, so they are
found as they should be.

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
2026-05-06 13:16:59 +02:00

71 lines
1.9 KiB
YAML

---
name: Linter
on:
pull_request:
types: [opened, synchronize]
jobs:
yamllint:
runs-on: infra-1
container:
image: quay.io/fedora/fedora:latest
steps:
- name: Install testing tools
run: |
dnf install -y yamllint nodejs git
- name: Checkout code
uses: https://code.forgejo.org/actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: https://code.forgejo.org/tj-actions/changed-files@v47
- name: Run yamllint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ "$file" == *.yml || "$file" == *.yaml ]]; then
yamllint "$file"
fi
done
ansible-lint:
runs-on: infra-1
container:
image: quay.io/fedora/fedora:latest
steps:
- name: Install testing tools
run: |
dnf install -y python3-pip nodejs git
pip3 install ansible-core ansible-lint
- name: Install ansible collections
run: |
ansible-galaxy collection install \
community.zabbix \
community.general \
ansible.posix
- name: Checkout code
uses: https://code.forgejo.org/actions/checkout@v6
with:
fetch-depth: 0
- name: Create symlink to overcome absolute paths
run: |
mkdir -p /srv/web/infra/
ln -s /workspace/infra/ansible /srv/web/infra/ansible
- name: Get changed files
id: changed-files
uses: https://code.forgejo.org/tj-actions/changed-files@v47
- name: Run ansible-lint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
ansible-lint "$file"
done