Skip to content

[CI] Validate for unique network_ids in merchants.yaml #101

[CI] Validate for unique network_ids in merchants.yaml

[CI] Validate for unique network_ids in merchants.yaml #101

Workflow file for this run

name: Ruby
on:
push:
branches:
- main
pull_request:
jobs:
rspec:
runs-on: ubuntu-latest
name: RSpec (Ruby ${{ matrix.ruby }})
strategy:
matrix:
ruby:
- "3.1" # Minimum supported version
- "3.2"
- "3.3"
- "ruby" # Latest stable version
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run RSpec
run: bundle exec rspec
validate-yaml:
runs-on: ubuntu-latest
name: Validate YAML
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install -g ajv-cli
- name: Validate merchants.yaml
run: ajv -s lib/yellow_pages/merchants.schema.json -d lib/yellow_pages/merchants.yaml --errors=text
- name: Validate unique network_ids in merchants.yaml
run: if [[ $(yq 'map(.network_ids) | flatten | sort' lib/yellow_pages/merchants.yaml | uniq -cd | tee /dev/tty) ]]; then exit 1; else exit 0; fi
- name: Validate categories.yaml
run: ajv -s lib/yellow_pages/categories.schema.json -d lib/yellow_pages/categories.yaml --errors=text