File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments