Skip to content

Commit 28db140

Browse files
committed
match current workflow
1 parent 4510b0b commit 28db140

File tree

1 file changed

+7
-60
lines changed

1 file changed

+7
-60
lines changed

.github/workflows/check-llms.yml

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,13 @@
1-
name: Validate llms-full.txt
1+
name: Validate llms.txt
22

33
on:
44
pull_request:
55
branches: [master]
66

77
jobs:
8-
check-llms:
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v3
14-
15-
- name: Set up Python
16-
uses: actions/setup-python@v4
17-
with:
18-
python-version: '3.x'
19-
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install pyyaml requests
24-
25-
- name: Get SHA256 hash of the PR's llms-full.txt file
26-
id: pr_llms_hash
27-
run: |
28-
if [ -f "llms-full.txt" ]; then
29-
# Calculate SHA256 hash of the llms-full.txt file in the PR branch (checked out by default)
30-
sha256sum llms-full.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-full.txt using the Python script
37-
run: python3 scripts/generate_llms.py
38-
39-
- name: Calculate SHA256 hash of the generated llms-full.txt
40-
id: generated_llms_hash
41-
run: |
42-
# Full path to the generated llms-full.txt file
43-
llms_file="/home/runner/work/polkadot-docs/polkadot-docs/llms-full.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-full.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-full.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-full.txt file is consistent."
66-
fi
8+
validate:
9+
uses: papermoonio/workflows/.github/workflows/validate-llms.yml@main
10+
with:
11+
llms_filename: "llms.txt"
12+
generator_command: "python3 scripts/generate_llms.py"
13+
require_pr_file: false

0 commit comments

Comments
 (0)