Skip to content

Fix copyright headers stage 2 #1098

Fix copyright headers stage 2

Fix copyright headers stage 2 #1098

name: "Validate library-and-framework-list.json"
on:
pull_request:
jobs:
validate-library-and-framework-list-json:
name: "📋 Validate the JSON file"
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v4
- name: "🔎 Detect relevant file changes"
id: filter
uses: ./.github/actions/detect-file-changes
with:
file-patterns: |
- 'library-and-framework-list*.json'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
if: steps.filter.outputs.changed == 'true'
- name: Check that the JSON file is well-formatted and sorted by artifact
if: steps.filter.outputs.changed == 'true'
run: |
JSON="library-and-framework-list.json"
if ! jq -e . "${JSON}" >/dev/null; then
echo "'${JSON}' fails to parse. Please make sure it is a valid JSON file."
exit 6
fi
DIFF=$(diff "${JSON}" <(jq -s '.[] | sort_by(.artifact)' "${JSON}"))
if [[ -n "${DIFF}" ]]; then
echo "'${JSON}' is no longer sorted by artifact key. You can use 'jq' to sort it: 'sorted="$(jq -s '.[] | sort_by(.artifact)' ${JSON})" && echo -E "${sorted}" > ${JSON}"
exit 8
fi
- name: Check that the JSON file conforms to the schema
if: steps.filter.outputs.changed == 'true'
run: |
pip install check-jsonschema
check-jsonschema --schemafile library-and-framework-list-schema.json library-and-framework-list.json