Skip to content

Commit 657bba2

Browse files
committed
ci: yaml lint
Signed-off-by: Bird <[email protected]>
1 parent 9fa5445 commit 657bba2

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/lint-yaml.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Yaml Lint
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- '**.yaml'
8+
- '**.yml'
9+
10+
jobs:
11+
yamlLint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Remove All Strings In Square Brackets
16+
run: |
17+
# remove strings in "[[]]" in .yml or .yaml files, or yaml lint will fail
18+
sed -i "s/\[\[.*\]\]//g" `grep "\[\[.*\]\]" -rl --include="*.yml" --include="*.yaml" .`
19+
- name: Yaml Lint
20+
uses: ibiqlik/action-yamllint@v3
21+
with:
22+
file_or_dir: .
23+
config_file: .yamllint.yml

.yamllint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
extends: default
2+
rules:
3+
brackets: disable # do not check brackets
4+
comments:
5+
require-starting-space: true
6+
min-spaces-from-content: 1 # at leaset 1 space between comment and content
7+
document-start: disable # whether the document must start with '---' is optional
8+
indentation:
9+
spaces: 2
10+
# block sequences should not be indented
11+
# e.g.:
12+
# OK:
13+
# key:
14+
# - value1
15+
# - value2
16+
# NOT OK:
17+
# key:
18+
# - value1
19+
# - value2
20+
indent-sequences: false
21+
line-length: disable
22+
new-line-at-end-of-file: enable # must have a new line at the end of file
23+
trailing-spaces: disable # do not check trailing spaces
24+
truthy: disable # do not check truthy
25+
ignore: |
26+
*.tpl.yaml
27+
*.tpl.yml
28+
*tmpl.yaml
29+
*tmpl.yml
30+
*template.yml
31+
*template.yaml
32+
**/.github/**
33+
**/githubactions/**
34+
**/workflows/**

0 commit comments

Comments
 (0)