Skip to content

Commit 754857e

Browse files
Adding CI validation for manifest.json (#447)
1 parent 1a15b20 commit 754857e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Validate manifest.json
2+
3+
on: push
4+
5+
jobs:
6+
validate:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 1
14+
15+
- name: Validate manifest.json
16+
id: validate_manifest
17+
run: |
18+
echo "Validating manifest files"
19+
for item in $(jq -c -r '.lists.[].file | select( . != null )' manifest.json); do
20+
if test -f $item; then
21+
echo "$item file is listed in the manifest, and exists in the repository"
22+
else
23+
echo "::error file=manifest.json,title=Invalid-Manifest::$item file is listed in the manifest, but the file does not exist"
24+
exit 1
25+
fi
26+
done
27+
28+
echo "Validating manifest urls"
29+
for item in $(jq -c -r '.lists.[].url | select( . != null )' manifest.json); do
30+
urlstatus=$(curl -H 'Cache-Control: no-cache' -o /dev/null --silent --head --write-out "$URL %{http_code}" "$item")
31+
if [ $urlstatus -ne 200 ]; then
32+
echo "::error file=manifest.json,title=Invalid-Manifest::$item URL is listed in the manifest, but the received HTTP status of $urlstatus"
33+
exit 1
34+
fi
35+
done
36+
37+
echo "Validation complete"

0 commit comments

Comments
 (0)