From: Giorgio Ravera Date: Tue, 23 May 2023 02:58:06 +0000 (+0200) Subject: Added YAML Validation X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=97e5c936b8a2ed9334bce29b8e591c01ee1c392f;p=homeassistant.git Added YAML Validation --- diff --git a/.github/workflows/ci-validation.yaml b/.github/workflows/ci-validation.yaml index 8f31239c..10107e21 100644 --- a/.github/workflows/ci-validation.yaml +++ b/.github/workflows/ci-validation.yaml @@ -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 index 00000000..f6bfd449 --- /dev/null +++ b/.github/workflows/yaml-validation.yaml @@ -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 index 00000000..dc0416d2 --- /dev/null +++ b/.yamllint/rules.yaml @@ -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