Skip to content

Commit 755cdab

Browse files
committed
updates
1 parent e150a8d commit 755cdab

File tree

2 files changed

+52
-22
lines changed

2 files changed

+52
-22
lines changed

.github/workflows/update-llms.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
branches: [ main, master ]
88
workflow_dispatch: # Allow manual triggering
9+
repository_dispatch: # Allow external triggers
10+
types: [update-llms]
911

1012
permissions:
1113
contents: write
@@ -23,18 +25,31 @@ jobs:
2325
uses: actions/setup-python@v4
2426
with:
2527
python-version: '3.12'
28+
cache: 'pip'
2629

2730
- name: Install uv
2831
run: |
2932
curl -LsSf https://astral.sh/uv/install.sh | sh
3033
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
3134
32-
- name: Install dependencies
35+
- name: Create venv and install dependencies
3336
run: |
34-
uv pip install .
37+
uv venv
38+
. .venv/bin/activate
39+
uv pip install git+https://github.com/ngmisl/llmstxt.git
3540
36-
- name: Generate llms.txt
37-
run: python llms.py
41+
- name: Clone target repository
42+
if: github.event_name == 'repository_dispatch'
43+
run: |
44+
git clone ${{ github.event.client_payload.repository }} target_repo
45+
cd target_repo
46+
python -m llmstxt
47+
48+
- name: Generate llms.txt for current repository
49+
if: github.event_name != 'repository_dispatch'
50+
run: |
51+
. .venv/bin/activate
52+
python -m llmstxt
3853
3954
- name: Check for changes
4055
id: changes
@@ -47,11 +62,15 @@ jobs:
4762
echo "changes=true" >> $GITHUB_OUTPUT
4863
fi
4964
50-
- name: Commit and push if changed
65+
- name: Create Pull Request
5166
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
67+
uses: peter-evans/create-pull-request@v5
68+
with:
69+
commit-message: "chore: update llms.txt"
70+
title: "chore: update llms.txt"
71+
body: |
72+
This PR updates the llms.txt file with the latest code compression.
73+
74+
Changes were automatically generated by [llmstxt](https://github.com/ngmisl/llmstxt).
75+
branch: update-llms
76+
delete-branch: true

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,37 @@ The script will:
6161

6262
### GitHub Actions Integration
6363

64-
This tool can automatically generate and update `llms.txt` in your repository using GitHub Actions. To set it up:
64+
There are two ways to use this tool with GitHub Actions:
6565

66-
1. Copy the workflow file:
66+
1. **For Your Own Repository**
6767
```bash
68+
# Create a workflow file
6869
mkdir -p .github/workflows
6970
curl -o .github/workflows/update-llms.yml https://raw.githubusercontent.com/ngmisl/llmstxt/main/.github/workflows/update-llms.yml
7071
```
7172

72-
2. Commit and push the workflow file:
73+
The workflow will:
74+
- Run automatically on pushes to main/master
75+
- Create a PR with updated llms.txt when changes are detected
76+
- Can be manually triggered from the Actions tab
77+
78+
2. **For Remote Repositories**
79+
You can trigger the action for any repository using the GitHub API:
80+
7381
```bash
74-
git add .github/workflows/update-llms.yml
75-
git commit -m "chore: add llmstxt workflow"
76-
git push
82+
curl -X POST \
83+
-H "Authorization: token $GITHUB_TOKEN" \
84+
-H "Accept: application/vnd.github.v3+json" \
85+
https://api.github.com/repos/ngmisl/llmstxt/dispatches \
86+
-d '{"event_type": "update-llms", "client_payload": {"repository": "https://github.com/user/repo.git"}}'
7787
```
7888

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
89+
This will:
90+
- Clone the target repository
91+
- Generate llms.txt
92+
- Create a PR with the changes
93+
94+
The workflow uses GitHub's PR system to ensure changes are reviewed before being merged.
8495

8596
## Output Format
8697

0 commit comments

Comments
 (0)