Add lint workflow
This commit is contained in:
51
.gitea/workflows/lint.yml
Normal file
51
.gitea/workflows/lint.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Linting
|
||||
|
||||
on:
|
||||
push
|
||||
|
||||
jobs:
|
||||
yamllint:
|
||||
name: YAML Lint
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install yamllint
|
||||
run: pip install yamllint
|
||||
|
||||
- name: Run yamllint
|
||||
run: yamllint . --format colored
|
||||
|
||||
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@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install ansible ansible-lint
|
||||
|
||||
# Создаем пустой vault password file если он указан в конфиге, но отсутствует
|
||||
- name: Fix vault issue
|
||||
run: |
|
||||
if grep -q "vault_password_file" ansible.cfg && [ ! -f ansible-vault-password-file ]; then
|
||||
echo "Creating empty vault password file for CI..."
|
||||
echo "foobar" > ansible-vault-password-file
|
||||
fi
|
||||
|
||||
- name: Run ansible-lint
|
||||
run: ansible-lint .
|
||||
Reference in New Issue
Block a user