diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index b35ea540..bf56e0cb 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -82,6 +82,25 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + - name: Validate hash.txt file + run: | + response=$(curl -s -w "%{http_code}" -o /tmp/hash.txt http://localhost:3000/hash.txt) + http_code=${response: -3} + if [ "$http_code" -ne 200 ]; then + echo "Error: HTTP request failed with status code $http_code" + exit 1 + fi + mime_type=$(file --mime-type -b /tmp/hash.txt) + if [ "$mime_type" != "text/html" ]; then + echo "Error: hash.txt does not have MIME type text/plain. Found: $mime_type" + exit 1 + fi + content_length=$(wc -c < /tmp/hash.txt | xargs) + if [ "$content_length" -ge 100 ]; then + echo "Error: hash.txt content exceeds 100 characters. Length: $content_length" + exit 1 + fi + echo "hash.txt is valid with MIME type $mime_type and length $content_length characters." - name: Run install run: npm ci - run: npx playwright install