Skip to content

JsonSchemaValidation

JSON-Schema based validation problem.

Defined by ValidationRule which supports workflows, actions, invalid content in the "Internal" ruleset along with YamlSyntaxError, YamlLoadError.

Description

JSON-Schema validation is required to ensure the GH-Lint object model is valid.

Fix the problems in the workflow file to make it validate against the JSON schema for the corresponding file type.

GitHub would also very likely reject the file with an error message similar to:

Invalid workflow file: .github/workflows/test.yml#L5
The workflow is not valid. .github/workflows/test.yml (Line: 5, Col: 17): Error message

Compliant example

Minimal valid workflow.

example.yml

on: push
jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"

Non-compliant examples

Non-compliant example #1

Requires at least one job in jobs:.

example.yml

on: push
jobs: {}

  • Line 2: Object has less than 1 properties (/jobs)

Non-compliant example #2

Missing on: trigger list.

example.yml

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"

  • Line 1: Object does not have some of the required properties [[on]] ()