Skip to content

Commit b8829b2

Browse files
committed
chore(llms.txt): Enhance workflow with concurrency, permissions, and improved validation for llms.txt generation
1 parent f2f0401 commit b8829b2

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

.github/workflows/llms-txt.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,80 @@ on:
1313
description: Git Hash (Optional)
1414
required: false
1515

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+
1625
jobs:
1726
generate-llms-txt:
1827
runs-on: ubuntu-latest
1928

2029
steps:
2130
- name: Checkout repository
2231
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.inputs.git-ref || github.ref }}
2334

2435
- name: Set up Ruby
2536
uses: ruby/setup-ruby@v1
2637
with:
27-
ruby-version: '3.1'
38+
ruby-version: '3.3'
2839
bundler-cache: true
2940

3041
- name: Set up Python
3142
uses: actions/setup-python@v5
3243
with:
33-
python-version: '3.11'
44+
python-version: '3.12'
45+
cache: 'pip'
46+
cache-dependency-path: 'scripts/requirements.txt'
3447

3548
- name: Install Python dependencies
3649
run: |
3750
python -m pip install --upgrade pip
38-
pip install pyyaml
51+
pip install -r scripts/requirements.txt
3952
4053
- name: Build Jekyll site
4154
env:
4255
JEKYLL_ENV: production
4356
run: |
44-
bundle exec jekyll build
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"
4565
4666
- name: Generate llms.txt
4767
run: |
4868
python scripts/generate_llms_txt.py
4969
50-
- name: Check llms.txt was generated
70+
- name: Validate llms.txt output
5171
run: |
5272
if [ ! -f llms.txt ]; then
5373
echo "Error: llms.txt was not generated"
5474
exit 1
5575
fi
56-
echo "llms.txt successfully generated"
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"
5784
echo "File size: $(wc -c < llms.txt) bytes"
5885
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')"
5990
6091
- name: Upload llms.txt as artifact
6192
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)