]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added YAML Validation
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 23 May 2023 02:58:06 +0000 (04:58 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 23 May 2023 02:58:06 +0000 (04:58 +0200)
.github/workflows/ci-validation.yaml
.github/workflows/yaml-validation.yaml [new file with mode: 0644]
.yamllint/rules.yaml [new file with mode: 0644]

index 8f31239c6edfd260608410cff704c87ca66ceb3c..10107e217203250e90d9bcf4c74bef8d994632a5 100644 (file)
@@ -1,4 +1,4 @@
-name: Home Assistant Configuration Check
+name: Configuration Validation Check
 
 on:
   push:
@@ -15,7 +15,7 @@ concurrency:
 
 jobs:
   build:
-
+    name: Validate Configuration
     runs-on: ubuntu-latest
 
     steps:
diff --git a/.github/workflows/yaml-validation.yaml b/.github/workflows/yaml-validation.yaml
new file mode 100644 (file)
index 0000000..f6bfd44
--- /dev/null
@@ -0,0 +1,24 @@
+name: YAML Validation Check
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+permissions:
+  contents: read
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  code_scan:
+    name: Validate YAML
+    runs-on: "ubuntu-latest"
+
+    steps:
+      - uses: actions/checkout@v3
+      - name: Validate YAML files
+        run: yamllint -c "./.yamllint/rules.yaml" .
diff --git a/.yamllint/rules.yaml b/.yamllint/rules.yaml
new file mode 100644 (file)
index 0000000..dc0416d
--- /dev/null
@@ -0,0 +1,32 @@
+# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
+
+extends: relaxed
+
+rules:
+  anchors:
+    forbid-undeclared-aliases: true
+    forbid-duplicated-anchors: true
+
+  #comments:
+  #  require-starting-space: true
+  #  ignore-shebangs: true
+  #  min-spaces-from-content: 2
+
+  comments-indentation: enable
+
+  # 255 chars should be enough, but don't fail if a line is longer
+  line-length:
+    max: 255
+    level: warning
+
+  new-line-at-end-of-file: enable
+
+  new-lines:
+    type: unix
+
+  #quoted-strings:
+  #  quote-type: any
+  #  required: true
+  #  extra-required: []
+  #  extra-allowed: []
+  #  allow-quoted-quotes: false