-
Notifications
You must be signed in to change notification settings - Fork 40
37 lines (31 loc) · 1.32 KB
/
validate-manifest.yml
File metadata and controls
37 lines (31 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Validate manifest.json
on: push
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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"