enforce scenario normalization (#1718)

Closes #1713.
This commit is contained in:
Karl Ostmo 2024-01-05 17:21:21 -08:00 committed by GitHub
parent 47a8ffe115
commit a388af6155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 7 deletions

View File

@ -0,0 +1,27 @@
name: YAML normalization
on:
push:
paths:
- 'data/**.yaml'
branches:
- main
pull_request:
paths:
- 'data/**.yaml'
branches:
- main
jobs:
ensure-yaml-normalization:
name: Ensure YAML files are normalized
runs-on: ubuntu-latest
steps:
- name: 'Setup yq'
uses: dcarbone/install-yq-action@v1.1.1
with:
version: "v4.35.1"
download-compressed: true
- uses: actions/checkout@v3
- name: Normalize
run: |
scripts/normalize-all-yaml.sh
git diff --name-only --exit-code

View File

@ -205,7 +205,6 @@
#########################################
## METAL ##
#########################################
## VEINS
- in:
- [1, mountain]

View File

@ -1,6 +0,0 @@
#!/bin/bash -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR/..
find data/scenarios -type f -name '*.yaml' -print0 | xargs -0 --max-args 1 yq --inplace

8
scripts/normalize-all-yaml.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR/..
find data -type f -name '*.yaml' -print0 | xargs -0 --max-args 1 sed -i -e 's/[[:blank:]]\+$//'
find data -type f -name '*.yaml' -print0 | xargs -0 --max-args 1 yq --inplace