|
13 | 13 | description: Git Hash (Optional) |
14 | 14 | required: false |
15 | 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 | + |
16 | 25 | jobs: |
17 | 26 | generate-llms-txt: |
18 | 27 | runs-on: ubuntu-latest |
19 | 28 |
|
20 | 29 | steps: |
21 | 30 | - name: Checkout repository |
22 | 31 | uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + ref: ${{ github.event.inputs.git-ref || github.ref }} |
23 | 34 |
|
24 | 35 | - name: Set up Ruby |
25 | 36 | uses: ruby/setup-ruby@v1 |
26 | 37 | with: |
27 | | - ruby-version: '3.1' |
| 38 | + ruby-version: '3.3' |
28 | 39 | bundler-cache: true |
29 | 40 |
|
30 | 41 | - name: Set up Python |
31 | 42 | uses: actions/setup-python@v5 |
32 | 43 | with: |
33 | | - python-version: '3.11' |
| 44 | + python-version: '3.12' |
| 45 | + cache: 'pip' |
| 46 | + cache-dependency-path: 'scripts/requirements.txt' |
34 | 47 |
|
35 | 48 | - name: Install Python dependencies |
36 | 49 | run: | |
37 | 50 | python -m pip install --upgrade pip |
38 | | - pip install pyyaml |
| 51 | + pip install -r scripts/requirements.txt |
39 | 52 |
|
40 | 53 | - name: Build Jekyll site |
41 | 54 | env: |
42 | 55 | JEKYLL_ENV: production |
43 | 56 | 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" |
45 | 65 |
|
46 | 66 | - name: Generate llms.txt |
47 | 67 | run: | |
48 | 68 | python scripts/generate_llms_txt.py |
49 | 69 |
|
50 | | - - name: Check llms.txt was generated |
| 70 | + - name: Validate llms.txt output |
51 | 71 | run: | |
52 | 72 | if [ ! -f llms.txt ]; then |
53 | 73 | echo "Error: llms.txt was not generated" |
54 | 74 | exit 1 |
55 | 75 | 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" |
57 | 84 | echo "File size: $(wc -c < llms.txt) bytes" |
58 | 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')" |
59 | 90 |
|
60 | 91 | - name: Upload llms.txt as artifact |
61 | 92 | uses: actions/upload-artifact@v4 |
|
0 commit comments