Pre-commit hooks (#125)

* feat: pre-commit

* empty

* fix: requirements.txt
This commit is contained in:
samerbahri98 2022-10-27 02:15:24 +02:00 committed by GitHub
parent 45ddd65e74
commit 4f3b8ec9e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 7 deletions

View File

@ -12,3 +12,4 @@
- [ ] Ran `reset.yml` playbook - [ ] Ran `reset.yml` playbook
- [ ] Did not add any unnecessary changes - [ ] Did not add any unnecessary changes
- [ ] 🚀 - [ ] 🚀
- [ ] Ran pre-commit install at least once before committing

View File

@ -7,8 +7,8 @@ on:
- master - master
jobs: jobs:
ansible-lint: pre-commit-ci:
name: YAML Lint + Ansible Lint name: Pre-Commit
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -34,8 +34,5 @@ jobs:
ansible-galaxy install -r collections/requirements.yml ansible-galaxy install -r collections/requirements.yml
echo "::endgroup::" echo "::endgroup::"
- name: Run yamllint - name: Run pre-commit
run: yamllint . uses: pre-commit/action@v3.0.0
- name: Run ansible-lint
run: ansible-lint

21
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,21 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: detect-private-key
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.28.0
hooks:
- id: yamllint
args: [-c=.yamllint]
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v6.8.2
hooks:
- id: ansible-lint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
hooks:
- id: shellcheck

View File

@ -41,6 +41,7 @@ pathspec==0.10.1
pkgutil-resolve-name==1.3.10 pkgutil-resolve-name==1.3.10
platformdirs==2.5.2 platformdirs==2.5.2
pluggy==1.0.0 pluggy==1.0.0
pre-commit==2.20.0
pyasn1==0.4.8 pyasn1==0.4.8
pyasn1-modules==0.2.8 pyasn1-modules==0.2.8
pycparser==2.21 pycparser==2.21