Skip to content

Commit 26cf054

Browse files
authored
Merge pull request #1836 from USRSE/cdcore09/feat/llmstxt
2 parents ca2abf3 + e072fd3 commit 26cf054

File tree

5 files changed

+764
-0
lines changed

5 files changed

+764
-0
lines changed

.github/workflows/llms-txt.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Generate llms.txt
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
git-ref:
13+
description: Git Hash (Optional)
14+
required: false
15+
16+
# Cancel in-progress runs when a new run is triggered
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
# Restrict permissions following security best practices
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
generate-llms-txt:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.inputs.git-ref || github.ref }}
34+
35+
- name: Set up Ruby
36+
uses: ruby/setup-ruby@v1
37+
with:
38+
ruby-version: '3.3'
39+
bundler-cache: true
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: '3.12'
45+
cache: 'pip'
46+
cache-dependency-path: 'scripts/requirements.txt'
47+
48+
- name: Install Python dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install -r scripts/requirements.txt
52+
53+
- name: Build Jekyll site
54+
env:
55+
JEKYLL_ENV: production
56+
run: |
57+
bundle exec jekyll build --verbose
58+
59+
# Verify _site directory was created
60+
if [ ! -d "_site" ]; then
61+
echo "Error: Jekyll build failed - _site directory not found"
62+
exit 1
63+
fi
64+
echo "Jekyll build successful"
65+
66+
- name: Generate llms.txt
67+
run: |
68+
python scripts/generate_llms_txt.py
69+
70+
- name: Validate llms.txt output
71+
run: |
72+
if [ ! -f llms.txt ]; then
73+
echo "Error: llms.txt was not generated"
74+
exit 1
75+
fi
76+
77+
# Check file is not empty
78+
if [ ! -s llms.txt ]; then
79+
echo "Error: llms.txt is empty"
80+
exit 1
81+
fi
82+
83+
echo "llms.txt successfully generated and validated"
84+
echo "File size: $(wc -c < llms.txt) bytes"
85+
echo "Line count: $(wc -l < llms.txt) lines"
86+
echo ""
87+
echo "Statistics:"
88+
echo "- Sections: $(grep -c '^## ' llms.txt || echo '0')"
89+
echo "- Pages: $(grep -c '^- \[' llms.txt || echo '0')"
90+
91+
- name: Upload llms.txt as artifact
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: llms-txt
95+
path: llms.txt
96+
retention-days: 30
97+
98+
- name: Display first 50 lines of llms.txt
99+
run: |
100+
echo "=== First 50 lines of llms.txt ==="
101+
head -n 50 llms.txt

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ plugins:
4646
- jekyll-paginate
4747
- jekyll-feed
4848

49+
include:
50+
- llms.txt
51+
4952
exclude:
5053
- Gemfile
5154
- Gemfile.lock

0 commit comments

Comments
 (0)