CI: Run yamllint on added or modified YAML files
Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
5e735e8263
commit
24deb169fb
3 changed files with 46 additions and 0 deletions
24
ci/yamllint-diff.yaml
Normal file
24
ci/yamllint-diff.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Install yamllint
|
||||
package:
|
||||
name: yamllint
|
||||
state: latest
|
||||
|
||||
- name: Determine added or modified YAML files
|
||||
command:
|
||||
cmd: >
|
||||
git diff --name-only --diff-filter=AM
|
||||
origin/{{ zuul.branch|quote }}...{{ zuul.branch|quote }}
|
||||
args:
|
||||
chdir: '{{ zuul.project.src_dir }}'
|
||||
register: fi_ansible__added_modified_yaml_files
|
||||
changed_when: "False"
|
||||
failed_when: fi_ansible__added_modified_yaml_files.rc != 0
|
||||
|
||||
- name: Run yamllint on changed YAML files
|
||||
command: yamllint {{ item }}
|
||||
args:
|
||||
chdir: '{{ zuul.project.src_dir }}'
|
||||
with_items: "{{ fi_ansible__added_modified_yaml_files.stdout_lines | list }}"
|
Loading…
Add table
Add a link
Reference in a new issue