diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5349357..4a78b88 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,3 +12,4 @@ - [ ] Ran `reset.yml` playbook - [ ] Did not add any unnecessary changes - [ ] 🚀 +- [ ] Ran pre-commit install at least once before committing diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b1a46c3..64ce6a8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,8 +7,8 @@ on: - master jobs: - ansible-lint: - name: YAML Lint + Ansible Lint + pre-commit-ci: + name: Pre-Commit runs-on: ubuntu-latest steps: @@ -34,8 +34,5 @@ jobs: ansible-galaxy install -r collections/requirements.yml echo "::endgroup::" - - name: Run yamllint - run: yamllint . - - - name: Run ansible-lint - run: ansible-lint + - name: Run pre-commit + uses: pre-commit/action@v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7583144 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/requirements.txt b/requirements.txt index fd36176..5defbe6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -41,6 +41,7 @@ pathspec==0.10.1 pkgutil-resolve-name==1.3.10 platformdirs==2.5.2 pluggy==1.0.0 +pre-commit==2.20.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21