Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/validate-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate manifest.json

on: push

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Validate manifest.json
id: validate_manifest
run: |
echo "Validating manifest files"
for item in $(jq -c -r '.lists.[].file | select( . != null )' manifest.json); do
if test -f $item; then
echo "$item file is listed in the manifest, and exists in the repository"
else
echo "::error file=manifest.json,title=Invalid-Manifest::$item file is listed in the manifest, but the file does not exist"
exit 1
fi
done

echo "Validating manifest urls"
for item in $(jq -c -r '.lists.[].url | select( . != null )' manifest.json); do
urlstatus=$(curl -H 'Cache-Control: no-cache' -o /dev/null --silent --head --write-out "$URL %{http_code}" "$item")
if [ $urlstatus -ne 200 ]; then
echo "::error file=manifest.json,title=Invalid-Manifest::$item URL is listed in the manifest, but the received HTTP status of $urlstatus"
exit 1
fi
done

echo "Validation complete"