Get the llms.txt Generator action up and running in 5 minutes.
Create .github/workflows/generate-llms-txt.yml in your repository:
name: Generate llms.txt
on:
push:
branches: [main]
paths:
- 'docs/**'
- '*.md'
permissions:
contents: write
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate llms.txt files
uses: your-org/your-repo/src@v1
with:
base-url: 'https://your-site.com'
project-name: 'Your Project Name'
commit-changes: 'true'Replace:
your-org/your-repowith your GitHub repository pathhttps://your-site.comwith your documentation URLYour Project Namewith your project name
git add .github/workflows/generate-llms-txt.yml
git commit -m "Add llms.txt generator workflow"
git push- Go to your repository on GitHub
- Click the "Actions" tab
- You should see the "Generate llms.txt" workflow running
- Once complete, check your repository for
llms.txtandllms-full.txt
- uses: your-org/your-repo/src@v1
with:
base-url: 'https://your-site.com'
project-name: 'Your Project'
sections: |
{
"Documentation": "docs/**",
"Guides": "guides/**",
"API": "api/**"
}- uses: your-org/your-repo/src@v1
with:
base-url: 'https://your-site.com'
project-name: 'Your Project'
exclude-pattern: '**/node_modules/**,**/draft/**'- uses: your-org/your-repo/src@v1
with:
input-directory: 'documentation'
output-directory: 'public'
base-url: 'https://your-site.com'
project-name: 'Your Project'- uses: your-org/your-repo/src@v1
with:
input-directory: 'docs'
base-url: 'https://docs.example.com'
project-name: 'My Documentation'
project-description: 'Comprehensive documentation for developers'
sections: |
{
"Getting Started": "docs/getting-started/**",
"API Reference": "docs/api/**",
"Guides": "docs/guides/**"
}- uses: your-org/your-repo/src@v1
with:
output-directory: 'docs'
base-url: 'https://username.github.io/repo'
project-name: 'My Project'
commit-changes: 'true'- uses: your-org/your-repo/src@v1
with:
input-directory: 'packages/docs'
output-directory: 'packages/docs'
base-url: 'https://example.com'
project-name: 'Package Documentation'Check:
- Markdown files exist in
input-directory - Files have
.md,.mdx, or.markdownextensions - Files aren't excluded by
exclude-pattern
Debug:
- name: List markdown files
run: find . -name "*.md" -type f
- name: Generate llms.txt
uses: your-org/your-repo/src@v1
with:
# ... your configFix: Add permissions to workflow:
permissions:
contents: writeCheck:
commit-changesis set to'true'(string, not boolean)- Workflow has write permissions
- Files actually changed (no commit if unchanged)
- Read the full documentation
- Check out example workflows
- Learn about contributing
- See testing guide
# My Project
> A brief description of my project
## Documentation
- [Getting Started](https://example.com/docs/getting-started): Learn how to get started
- [Installation](https://example.com/docs/installation): Installation guide
## Guides
- [Tutorial](https://example.com/guides/tutorial): Step-by-step tutorialSource: https://example.com/docs/getting-started
# Getting Started
Welcome to the documentation...
Source: https://example.com/docs/installation
# Installation
Follow these steps to install...That's it! You're now generating llms.txt files automatically. 🎉