Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add test for checking existannce of public/hash.txt file #1010

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ "$mime_type" != "text/html" ]; then
if [ "$mime_type" != "text/plain" ]; 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
Expand Down
Loading