github: add new workflow for checking json files

Reformat all json files in the repository and check that they're
formatted properly.
This commit is contained in:
Achilleas Koutsou 2024-03-25 18:07:15 +01:00 committed by Simon de Vlieger
parent 0799328a6a
commit 7f6dea860a

View file

@ -73,3 +73,20 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check for valid snapshot urls
run: ./tools/check-snapshots --errors-only .
json-fmt:
name: "🔍 Check JSON files for formatting consistency"
runs-on: ubuntu-20.04
steps:
- name: Install utils
run: |
sudo apt update
sudo apt install -y jq moreutils
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Reformat all json files
run: find -iname "*.json" -print -exec sh -c 'jq --indent 2 . {} | sponge {}' \;
- name: Check diff
run: git diff --exit-code