Skip to content

Commit 23d59a7

Browse files
committed
fix: add test for checking existannce of public/hash.txt file
1 parent c80089f commit 23d59a7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/validate.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ jobs:
8282
- uses: actions/setup-node@v3
8383
with:
8484
node-version: 18
85+
- name: Validate hash.txt file
86+
run: |
87+
response=$(curl -s -w "%{http_code}" -o /tmp/hash.txt http://localhost:3000/hash.txt)
88+
http_code=${response: -3}
89+
if [ "$http_code" -ne 200 ]; then
90+
echo "Error: HTTP request failed with status code $http_code"
91+
exit 1
92+
fi
93+
mime_type=$(file --mime-type -b /tmp/hash.txt)
94+
if [ "$mime_type" != "text/plain" ]; then
95+
echo "Error: hash.txt does not have MIME type text/plain. Found: $mime_type"
96+
exit 1
97+
fi
98+
content_length=$(wc -c < /tmp/hash.txt | xargs)
99+
if [ "$content_length" -ge 100 ]; then
100+
echo "Error: hash.txt content exceeds 100 characters. Length: $content_length"
101+
exit 1
102+
fi
103+
echo "hash.txt is valid with MIME type $mime_type and length $content_length characters."
85104
- name: Run install
86105
run: npm ci
87106
- run: npx playwright install

0 commit comments

Comments
 (0)