Skip to content

Commit d32018f

Browse files
committed
update script
1 parent 54889ba commit d32018f

File tree

4 files changed

+27633
-1
lines changed

4 files changed

+27633
-1
lines changed

.github/workflows/check-llms.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Validate llms.txt
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check-llms:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
25+
- name: Get SHA256 hash of the PR's llms.txt file
26+
id: pr_llms_hash
27+
run: |
28+
if [ -f "llms.txt" ]; then
29+
# Calculate SHA256 hash of the llms.txt file in the PR branch (checked out by default)
30+
sha256sum llms.txt | awk '{ print $1 }' > pr_sha256.txt
31+
else
32+
echo "0000" > pr_sha256.txt
33+
fi
34+
cat pr_sha256.txt
35+
36+
- name: Generate llms.txt using the Python script
37+
run: python3 scripts/generate_llms.py
38+
39+
- name: Calculate SHA256 hash of the generated llms.txt
40+
id: generated_llms_hash
41+
run: |
42+
# Full path to the generated llms.txt file
43+
llms_file="/home/runner/work/polkadot-docs/polkadot-docs/llms.txt"
44+
45+
# Check if the file exists before calculating the hash
46+
if [ -f "$llms_file" ]; then
47+
sha256sum "$llms_file" | awk '{ print $1 }' > generated_sha256.txt
48+
else
49+
echo "Error: llms.txt not found at $llms_file"
50+
exit 1
51+
fi
52+
cat generated_sha256.txt
53+
54+
- name: Compare the SHA256 hashes
55+
run: |
56+
generated_hash=$(cat generated_sha256.txt)
57+
pr_hash=$(cat pr_sha256.txt)
58+
59+
if [ "$generated_hash" != "$pr_hash" ]; then
60+
echo "Error: SHA256 hashes do not match. The generated llms.txt file differs from the one in the PR."
61+
echo "You need to run the generate LLMS script:"
62+
echo "python3 scripts/generate_llms.py"
63+
exit 1
64+
else
65+
echo "SHA256 hashes match. The llms.txt file is consistent."
66+
fi

infrastructure/running-a-validator/onboarding-and-offboarding/set-up-validator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Once the Polkadot binaries are installed, it's essential to verify that everythi
205205

206206
The output should show the version numbers for each of the binaries. Ensure that the versions match and are consistent, similar to the following example (the specific version may vary):
207207

208-
--8<-- 'code/infrastructure/running-a-validator/onboarding-and-offboarding/requirements/terminal-output-01.html'
208+
--8<-- 'code/infrastructure/running-a-validator/onboarding-and-offboarding/set-up-a-validator/terminal-output-01.html'
209209

210210
If the versions do not match or if there is an error, double-check that all the binaries were correctly installed and are accessible within your `$PATH`.
211211

0 commit comments

Comments
 (0)