A GitHub Action that automatically generates llms.txt and llms-full.txt files from your markdown documentation, following the official llms.txt specification.
- π Generates both
llms.txt(index) andllms-full.txt(full content) - ποΈ Organizes documentation into customizable sections
- π Automatically extracts titles, descriptions, and generates URLs
- π― Supports glob patterns for file filtering
- π€ Optional auto-commit of generated files
- β‘ Fast recursive directory scanning
- π‘οΈ Robust error handling and validation
Add this workflow to your repository at .github/workflows/generate-llms-txt.yml:
name: Generate llms.txt
on:
push:
branches: [main]
paths:
- 'docs/**'
- '*.md'
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Generate llms.txt files
uses: robbrad/llmstxt-generator-github-action@0.0.1
with:
base-url: 'https://example.com'
project-name: 'My Project'
project-description: 'A brief description of my project'
commit-changes: 'true'- Action README - Complete usage guide
- Contributing Guide - How to contribute
- Publishing Guide - How to release new versions
- uses: your-org/your-repo/src@v1
with:
base-url: 'https://example.com'
project-name: 'My Project'- uses: your-org/your-repo/src@v1
with:
base-url: 'https://example.com'
project-name: 'My Project'
sections: |
{
"Docs": "docs/**",
"Guides": "guides/**",
"Examples": "examples/**"
}- uses: your-org/your-repo/src@v1
with:
input-directory: 'documentation'
output-directory: 'public'
base-url: 'https://docs.example.com'
project-name: 'My Project'| Input | Required | Default | Description |
|---|---|---|---|
base-url |
Yes | - | Base URL for generating links |
project-name |
Yes | - | Project name for the H1 header |
input-directory |
No | . |
Directory containing markdown files |
output-directory |
No | . |
Directory for output files |
project-description |
No | '' |
Short project summary |
exclude-pattern |
No | '' |
Glob pattern for exclusions |
sections |
No | {"Docs": "**"} |
JSON mapping of sections |
commit-changes |
No | false |
Auto-commit generated files |
| Output | Description |
|---|---|
files-processed |
Number of markdown files processed |
llms-txt-path |
Path to generated llms.txt |
llms-full-txt-path |
Path to generated llms-full.txt |
cd src
npm installnpm run build# Unit tests
npm test
# Integration tests
npm run test:integration
# All tests
npm run test:allnpm run bundle.
βββ .github/
β βββ actions/
β β βββ llms-txt-generator/ # Main action code
β β βββ src # TypeScript source
β β βββ tests/ # Integration tests
β β βββ dist/ # Compiled bundle
β β βββ action.yml # Action metadata
β βββ workflows/
β βββ ci.yml # CI pipeline
β βββ release.yml # Release automation
β βββ test-scenarios.yml # Comprehensive tests
βββ CONTRIBUTING.md # Contribution guide
βββ PUBLISHING.md # Release guide
βββ README.md # This file
The project includes comprehensive CI/CD:
-
CI Workflow: Runs on every push/PR
- Unit tests
- Integration tests
- Build verification
- Bundle size check
- TypeScript compilation check
-
Release Workflow: Runs on tag push
- Full test suite
- Build and bundle
- Create GitHub release
- Generate changelog
- Update major version tag
-
Test Scenarios: Comprehensive test coverage
- Basic usage
- Complex structures
- Special characters
- Exclude patterns
- Empty/malformed files
- Different file extensions
The action includes multiple test layers:
- Unit Tests: Test individual functions
- Integration Tests: Test the complete workflow
- Scenario Tests: Test real-world use cases
Run all tests:
cd src
npm run test:allContributions are welcome! Please see CONTRIBUTING.md for guidelines.
To publish a new version:
- Update version:
npm version patch|minor|major - Build:
npm run package - Commit:
git add dist/ && git commit -m "chore: update bundle" - Push:
git push origin main --tags
See PUBLISHING.md for detailed instructions.
MIT
- π Report a bug
- π‘ Request a feature
- π¬ Ask a question
Built following the llms.txt specification by Anthropic.