Skip to content

Commit

Permalink
Merge pull request #7 from mhpob/yamale
Browse files Browse the repository at this point in the history
Adjust metadata schema validation action
  • Loading branch information
jdpye authored Mar 27, 2024
2 parents 1915d34 + d329e9c commit 53a0fba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/validate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Validation
name: Validate metadata

on:
push:
branches: [main, yamale]
paths:
- '**metadata.ya?ml'
pull_request:
workflow_dispatch:

Expand All @@ -14,7 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- id: file-matrix
run: echo "::set-output name=matrix::$(find -iname metadata.yaml | jq -Rsc 'split("\n")[:-1]')"
run: |
echo "matrix=$(find -iname metadata.yaml | jq -Rsc 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
yamale-validate:
needs: list-metadata-files
Expand All @@ -31,11 +33,13 @@ jobs:
run: "pip install yamale"

- name: Install ruamel
run: "pip install ruamel.yaml"
run: |
pip install ruamel.yaml \
pip install ruamel.yaml.cmd
- name: Run Yamale
run: |
yamale -s schema.yaml -p ruamel ${{ matrix.metadata-file }}
yamale -s ./test/metadata_schema.yaml -p ruamel ${{ matrix.metadata-file }}
# cff-validate:
# needs: list-metadata-files
Expand Down
11 changes: 9 additions & 2 deletions raw/innovasea/vr2/VR2PC-v1.00/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ poc:
contact: "[email protected]"
citation.cff:
cff-version: 1.2.0 # https://citation-file-format.github.io/
authors:
- family-names: "Wingate"
given-names: "Rebecca"
- family-names: "Secor"
given-names: "David"
orcid: "https://orcid.org/0000-0001-6007-4827"
title: "VR2 3145 20041115.000"
message: "Please cite this dataset using the metadata from 'preferred-citation'."
preferred-citation:
type: article
Expand All @@ -26,8 +33,8 @@ citation.cff:
format: ASCII text
size_bytes: 28381
recording:
start: 2004-09-27T12:56:01Z
end: 2004-11-15T08:02:28Z
start: "2004-09-27T12:56:01Z"
end: "2004-11-15T08:02:28Z"
creation_date: 2004-11-15
exporting_software:
name: VR2PC
Expand Down
4 changes: 2 additions & 2 deletions schema.yaml → test/metadata_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ citation.cff: map()
format: str()
size_bytes: int()
recording:
start: timestamp(min='1990-01-01 00:00:00')
end: timestamp(min='1990-01-01 00:00:00')
start: str()
end: str()
creation_date: day(min='1990-01-01')
exporting_software:
name: str()
Expand Down

0 comments on commit 53a0fba

Please sign in to comment.