Skip to content

Commit

Permalink
feat: add a workflow that checks the sorting of city names
Browse files Browse the repository at this point in the history
  • Loading branch information
thenishantsapkota committed Oct 27, 2023
1 parent 017901c commit ab7910e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 32 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/json-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check JSON

on: [push, pull_request]

jobs:
check-alphabetical-order:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install jq
run: sudo apt-get install jq -y

- name: Check JSON alphabetical order
run: |
# Get the JSON file
json_file="data/borderlines.json"
# Extract names from JSON and check if they are sorted
sorted_json=$(jq -c '.cities | sort_by(.name | ascii_downcase)' "$json_file")
original_json=$(jq -c '.cities' "$json_file")
# Compare sorted and original JSON
if [ "$sorted_json" != "$original_json" ]; then
echo "Error: JSON entries are not in alphabetical order."
exit 1
fi
shell: bash
32 changes: 0 additions & 32 deletions .github/workflows/merge_response.yml

This file was deleted.

0 comments on commit ab7910e

Please sign in to comment.