[CI] Validate for unique network_ids
in merchants.yaml
#106
Workflow file for this run
This file contains 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: CI | |
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: | | |
DUPLICATES="$(yq 'map(.network_ids) | flatten | sort' lib/yellow_pages/merchants.yaml | uniq -cd)" | |
echo "::error ::${DUPLICATES}" | |
if [[ DUPLICATES ]]; 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 |