Trying a different approach using bash #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 exists" | |
| else | |
| echo "Error: $item 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 "$item has HTTP status $urlstatus" | |
| exit 1 | |
| fi | |
| done | |
| echo "Validation complete" |