Improved test coverage #134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate YAML Configs | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| # Run on all pull requests (any target branch). We keep push limited to `main` only. | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| validate-yaml: | |
| name: Validate tracked YAML config files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install PyYAML | |
| run: python -m pip install --upgrade pip PyYAML | |
| - name: Validate YAML files | |
| run: | | |
| set -euo pipefail | |
| files=$(git ls-files '*.yml' '*.yaml' | grep -E '(^|/)(config|countdowns|discord|locations|messages|plugin)\.ya?ml$' || true) | |
| if [ -z "$files" ]; then | |
| echo "No target YAML files found." | |
| exit 0 | |
| fi | |
| echo "Validating: $files" | |
| for f in $files; do | |
| echo "- $f" | |
| python3 -c "import yaml,sys; yaml.safe_load(open(sys.argv[1],'rb')); print(sys.argv[1]+': OK')" "$f" || { echo "YAML parse error in $f"; exit 2; } | |
| done |