Skip to content

Commit 654530c

Browse files
ofirc77NoamGaash
andauthored
chore: add hash.txt to the public folder (#1010)
Co-authored-by: Noam Gaash <[email protected]>
1 parent 67be2e5 commit 654530c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/validate.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
runs-on: ubuntu-latest
4747
steps:
4848
- uses: actions/checkout@v3
49+
- name: Get Commit Hash and generate Version File
50+
run: echo "$(git rev-parse --short HEAD)" >> public/hash.txt
4951
- name: Set up Docker Buildx
5052
uses: docker/setup-buildx-action@v3
5153
- name: Build and Export Docker image
@@ -82,6 +84,25 @@ jobs:
8284
- uses: actions/setup-node@v3
8385
with:
8486
node-version: 18
87+
- name: Validate hash.txt file
88+
run: |
89+
response=$(curl -s -w "%{http_code}" -o /tmp/hash.txt http://localhost:3000/hash.txt)
90+
http_code=${response: -3}
91+
if [ "$http_code" -ne 200 ]; then
92+
echo "Error: HTTP request failed with status code $http_code"
93+
exit 1
94+
fi
95+
mime_type=$(file --mime-type -b /tmp/hash.txt)
96+
if [ "$mime_type" != "text/plain" ]; then
97+
echo "Error: hash.txt does not have MIME type text/plain. Found: $mime_type"
98+
exit 1
99+
fi
100+
content_length=$(wc -c < /tmp/hash.txt | xargs)
101+
if [ "$content_length" -ge 100 ]; then
102+
echo "Error: hash.txt content exceeds 100 characters. Length: $content_length"
103+
exit 1
104+
fi
105+
echo "hash.txt is valid with MIME type $mime_type and length $content_length characters."
85106
- name: Run install
86107
run: npm ci
87108
- run: npx playwright install

0 commit comments

Comments
 (0)