@JMLX42 This adds a pre-commit hook and a GitHub Action running ansible-lint.
If I understand correctly merging can be protected against PR that do not pass linting by enabling the option Require status checks to pass before merging and the ansible-lint status check in the repository settings -> Branches -> Protect matching branches (the ansible-lint status check should appear in the list once this PR is merged).
I had to add two new ignored errors in the .ansible-lintskip_list:
'106' # Ignore error [106] Role name does not match ^[a-z][a-z0-9_]+$ pattern.
'208' # Ignore error [208] File permissions unset or incorrect.
Note that:
The pre-commit uses a regex and will lint all the .yml and .yaml files.
However globbing is currently broken in the ansible-lint-action:
@JMLX42 This adds a pre-commit hook and a GitHub Action running
ansible-lint
.If I understand correctly merging can be protected against PR that do not pass linting by enabling the option
Require status checks to pass before merging
and theansible-lint
status check in the repository settings -> Branches -> Protect matching branches (theansible-lint
status check should appear in the list once this PR is merged).I had to add two new ignored errors in the
.ansible-lint
skip_list
:Note that:
ansible-lint-action
:ansible-lint-action
is fixed.ansible
andansible-lint
used due to another bug:ansible-lint-action
is fixed.