Skip to content

Commit

Permalink
Add a workflow to validate YAML files
Browse files Browse the repository at this point in the history
The intent is that this should run on a pull request and be required
to pass before the pull request can be merged.

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler2 committed Apr 23, 2024
1 parent 33eea14 commit ce43a09
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 26 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/validate-yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# For documentation on the github environment, see
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
#
# For documentation on the syntax of this file, see
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Validate-YAML

on:
push:
branches: [main, next-minor, next-patch]
pull_request:
branches: [main, next-minor, next-patch]

permissions:
contents: read

jobs:
validate-yaml:
runs-on: ubuntu-latest

steps:
- name: Checkout GEDCOM.io
uses: actions/checkout@v4

- name: Validate YAML
run: yamllint .yamllint.yml _config.yml _config.dev.yml yaml-schema.yaml _data/navigation.yml .github/dependabot.yml .github/workflows/update-files.yml .github/workflows/validate-yaml.yml
7 changes: 7 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Configuration file for yamllint. For documentation, see
# https://yamllint.readthedocs.io/en/stable/configuration.html

extends: default

Check warning on line 4 in .yamllint.yml

View workflow job for this annotation

GitHub Actions / validate-yaml

4:1 [document-start] missing document start "---"

rules:
line-length: disable
10 changes: 5 additions & 5 deletions _config.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Develop override settings

url: http://127.0.0.1:4000
remote_theme: false
theme: minimal-mistakes-jekyll
# Develop override settings

Check failure on line 1 in _config.dev.yml

View workflow job for this annotation

GitHub Actions / validate-yaml

1:28 [new-lines] wrong new line character: expected \n

url: http://127.0.0.1:4000

Check warning on line 3 in _config.dev.yml

View workflow job for this annotation

GitHub Actions / validate-yaml

3:1 [document-start] missing document start "---"
remote_theme: false
theme: minimal-mistakes-jekyll

Check failure on line 5 in _config.dev.yml

View workflow job for this annotation

GitHub Actions / validate-yaml

5:32 [new-line-at-end-of-file] no new line character at the end of file
28 changes: 14 additions & 14 deletions _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ specs:
- title: "GEDCOM X"
url: "/specs/#gedcom-x"
tools:
- title: "Tools"
children:
- title: "Conversion tools"
url: "/tools/#v551-to-v70-conversion-code"
- title: "Parsers"
url: "/tools/#v70-parsers"
- title: "Development Aids"
url: "/tools/#development-aids"
- title: "Example files"
url: "/tools/#example-familysearch-gedcom-70-files"
- title: "Extension Registry"
url: "/tools/#yaml-file-format"
- title: "Other tools"
url: "/tools/#other-development-tools"
- title: "Tools"
children:
- title: "Conversion tools"
url: "/tools/#v551-to-v70-conversion-code"
- title: "Parsers"
url: "/tools/#v70-parsers"
- title: "Development Aids"
url: "/tools/#development-aids"
- title: "Example files"
url: "/tools/#example-familysearch-gedcom-70-files"
- title: "Extension Registry"
url: "/tools/#yaml-file-format"
- title: "Other tools"
url: "/tools/#other-development-tools"
guides:
- title: "Guides"

Check failure on line 37 in _data/navigation.yml

View workflow job for this annotation

GitHub Actions / validate-yaml

37:4 [indentation] wrong indentation: expected 2 but found 3
children:
Expand Down
14 changes: 7 additions & 7 deletions yaml-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
type: object

definitions:
uri:
uri:
type: string
simpler-pattern: "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"
pattern: "^([A-Za-z]([A-Za-z0-9]|\\+|\\-|\\.)*)\\:(//(((([-A-Z._a-z0-9]|~)|%[0-9A-Fa-f][0-9A-Fa-f]|(\\!|\\$|&|'|\\(|\\)|\\*|\\+|,|;|\\=)|\\:)*)@)?((\\[((([0-9A-Fa-f]{1,4}\\:){6}(([0-9A-Fa-f]{1,4}\\:[0-9A-Fa-f]{1,4})|([0-9]|[1-9][0-9]|1[0-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)*))?$"

lang:
type: string
pattern: "^[a-zA-Z]{2,3}(-[a-zA-Z]{3}){0,3}|[a-zA-Z]{4,8}(-[a-zA-Z]{4})?(-[a-zA-Z]{2}|[0-9]{3})?(-[a-zA-Z]{5,8}|[0-9][a-zA-Z0-9]{3})*(-[0-9A-WY-Za-wy-z](-[a-zA-Z0-9]{2,8})+)*(-x(-[a-zA-Z0-9]{1,8})+)?|x(-[a-zA-Z0-9]{1,8})+|en-GB-oed|i-(ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)|sgn-(BE-(FR|NL)|CH-DE)$"
Expand Down Expand Up @@ -98,22 +98,22 @@ allOf:
then: {required: [specification]}
- if: {properties: {type: {const: enumeration set}}}
then: {required: [enumeration values]}
- if:

- if:
properties:
type: {const: structure}
payload:
type: string
pattern: '^https://gedcom.io/terms/v7/type-(List#)?Enum$'
then: {required: [enumeration set]}
else: {not: {required: [enumeration set]}}
- if:

- if:
properties:
type:
pattern: "^(structure|enumeration|calendar|month)$"
then:
oneOf:
- {required: [standard tag]}
- {required: [extension tags]}

Check failure on line 119 in yaml-schema.yaml

View workflow job for this annotation

GitHub Actions / validate-yaml

119:1 [empty-lines] too many blank lines (1 > 0)

0 comments on commit ce43a09

Please sign in to comment.