Add lint step before commit #1
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: Lint JSON | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
json-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache APT packages | |
uses: actions/cache@v4 | |
with: | |
path: /var/cache/apt/archives | |
key: ${{ runner.os }}-apt-cache | |
restore-keys: | | |
${{ runner.os }}-apt-cache | |
- name: Update APT cache | |
run: sudo apt-get update | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Lint servers.json | |
run: | | |
if ! jq empty servers.json; then | |
echo "Invalid JSON file detected in servers.json" | |
exit 1 | |
else | |
echo "servers.json is valid" | |
fi |