forked from kubeflow/manifests
-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (43 loc) · 1.62 KB
/
yaml_formatter.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Proper Formatting on YAML files
on: [push, pull_request]
jobs:
format_YAML_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install yamllint
run: pip install yamllint
- name: YAML Formatting Guidelines
run: |
echo "### YAML Formatting Guidelines ###
If there is a formatting error in your YAML file, you will see errors like the one below:
'Error: 6:4 [indentation] wrong indentation: expected 2 but found 3'
To fix these errors, refer to the YAML formatting rules at:
https://yamllint.readthedocs.io/en/stable/rules.html#
Search for the keyword inside the brackets [] in the error message. In this example, it's 'indentation'.
Note: Some rules have been customized in the '.yamllint.yaml' file. Below is the content of that file:
extends: default
rules:
document-start:
present: false
document-end:
present: false
indentation:
indent-sequences: false
line-length:
max: 400
"
- name: Fetch master branch
run: git fetch origin master
- name: Set up changed files
run: |
git diff --name-only origin/master...HEAD | grep -E '^common/.*\.ya?ml$|^example/.*\.ya?ml$' > changed_files_in_PR.txt || true
- name: Display changed files
run: cat changed_files_in_PR.txt
- name: Run yamllint on changed files
run: |
chmod +x ./run_yamllint.sh
./run_yamllint.sh
shell: bash