yaml-validator icon indicating copy to clipboard operation
yaml-validator copied to clipboard

Git Hub Actions

Open KingBain opened this issue 2 years ago • 1 comments

I had a github action that was running yamllint to handle linting of YAML files, but a couple yaml files had syntax errors that were being detected in vscode by the redhat yaml parser, but not detected in the linting.

Anyways, I was looking for a tool that supported syntax chacking and it looks like yaml-validator does it.

So I was playing around with a github action for yaml-validator


---
name: Yaml Syntax Validation
on:
  pull_request:
    paths: ['**.yaml']
jobs:
  run-npm-install:
    name: Yaml Syntax Validation Install
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: npm install
        run: |
          npm install --global yaml-validator
      - name: validate
        run: |
          find . -iname '*.yaml' -exec yaml-validator "{}" +
...

it works alright, but I was wondering if others had built up their own github actions ? Could those share their examples.

KingBain avatar Feb 28 '23 04:02 KingBain

example of the bad syntax


bad indentation of a mapping entry (29:35)

 26 |       - name: example-allowed
 27 |         object: private-gke/gke/containercluster.yaml
 28 |         assertions:
 29 |           - violations: violations: false
----------------------------------------^

KingBain avatar Feb 28 '23 04:02 KingBain