File tree Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Update llms.txt
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ workflow_dispatch : # Allow manual triggering
9+
10+ permissions :
11+ contents : write
12+ pull-requests : write
13+
14+ jobs :
15+ update-llms :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Set up Python
23+ uses : actions/setup-python@v4
24+ with :
25+ python-version : ' 3.12'
26+
27+ - name : Install uv
28+ run : |
29+ curl -LsSf https://astral.sh/uv/install.sh | sh
30+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
31+
32+ - name : Install dependencies
33+ run : |
34+ uv pip install .
35+
36+ - name : Generate llms.txt
37+ run : python llms.py
38+
39+ - name : Check for changes
40+ id : changes
41+ run : |
42+ if git diff --quiet llms.txt; then
43+ echo "No changes to llms.txt"
44+ echo "changes=false" >> $GITHUB_OUTPUT
45+ else
46+ echo "Changes detected in llms.txt"
47+ echo "changes=true" >> $GITHUB_OUTPUT
48+ fi
49+
50+ - name : Commit and push if changed
51+ if : steps.changes.outputs.changes == 'true'
52+ run : |
53+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
54+ git config --local user.name "github-actions[bot]"
55+ git add llms.txt
56+ git commit -m "chore: update llms.txt [skip ci]"
57+ git push
Original file line number Diff line number Diff line change 11[ ![ CodeQL Advanced] ( https://github.com/ngmisl/llmstxt/actions/workflows/codeql.yml/badge.svg )] ( https://github.com/ngmisl/llmstxt/actions/workflows/codeql.yml )
2+ [ ![ Update llms.txt] ( https://github.com/ngmisl/llmstxt/actions/workflows/update-llms.yml/badge.svg )] ( https://github.com/ngmisl/llmstxt/actions/workflows/update-llms.yml )
23
34# llmstxt
45
@@ -46,17 +47,41 @@ uv pip install -e ".[dev]"
4647
4748## Usage
4849
50+ ### Local Usage
51+
4952``` bash
5053# Generate llms.txt from current directory
5154python llms.py
5255```
5356
5457The script will:
55-
56581 . Scan the current directory recursively
57592 . Process files according to .gitignore rules
58603 . Generate ` llms.txt ` with compressed content
5961
62+ ### GitHub Actions Integration
63+
64+ This tool can automatically generate and update ` llms.txt ` in your repository using GitHub Actions. To set it up:
65+
66+ 1 . Copy the workflow file:
67+ ``` bash
68+ mkdir -p .github/workflows
69+ curl -o .github/workflows/update-llms.yml https://raw.githubusercontent.com/ngmisl/llmstxt/main/.github/workflows/update-llms.yml
70+ ```
71+
72+ 2 . Commit and push the workflow file:
73+ ``` bash
74+ git add .github/workflows/update-llms.yml
75+ git commit -m " chore: add llmstxt workflow"
76+ git push
77+ ```
78+
79+ The workflow will:
80+ - Run automatically on pushes to main/master
81+ - Generate/update llms.txt
82+ - Commit and push changes if needed
83+ - Can be manually triggered from the Actions tab
84+
6085## Output Format
6186
6287The generated ` llms.txt ` file follows this structure:
You can’t perform that action at this time.
0 commit comments