-
-
Notifications
You must be signed in to change notification settings - Fork 265
49 lines (45 loc) · 1.29 KB
/
validate_yamllint.yml
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
---
name: Validate YAML (secondary files)
# yamllint disable-line rule:truthy
on:
push:
paths:
- '**/*.yml'
- '**/*.yaml'
pull_request:
paths:
- '**/*.yml'
- '**/*.yaml'
workflow_dispatch:
jobs:
code_scan:
name: Validate YAML
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@main
with:
fetch-depth: '0'
- name: Identify changed files
uses: tj-actions/changed-files@v41
id: changed-files
with:
files: '**/*.y*ml'
separator: ","
- name: Validate YAML
if: steps.changed-files.outputs.any_changed == 'true'
run: |
IFS=',' read -ra FILES <<< "${{ steps.changed-files.outputs.all_changed_files }}"
for file in "${FILES[@]}"; do
if [[ "$file" =~ ^nspanel_esphome.*\.yaml$ ]] || \
[[ "$file" =~ ^esphome/nspanel_esphome.*\.yaml$ ]] || \
[[ "$file" =~ ^prebuilt/nspanel_esphome.*\.yaml$ ]] || \
[[ "$file" == "nspanel_blueprint.yaml" ]]; then
echo "Skipping $file"
continue
fi
echo "::group::Validating $file"
yamllint -c "./.rules/yamllint.yml" "$file"
echo "::endgroup::"
done
...