LLM Docs Update #272
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: LLM Docs Update | |
| on: | |
| workflow_dispatch: # Allows manual triggering | |
| schedule: | |
| - cron: '0 0 * * *' # Runs daily at midnight UTC | |
| jobs: | |
| update-llms: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Compile llms.txt | |
| run: | | |
| # Concatenate all the markdown docs, minus everything after "## Contributors" in README.md, and write to docs/llms.txt | |
| (sed '/## Contributors/q' README.md; for file in docs/*.md; do echo -e "\n\n\n\n\n---\n\n\n\n\n"; cat "$file"; done) > docs/llms.txt | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "No changes to llms.txt; exiting." | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected in llms.txt." | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create PR with auto-merge | |
| if: steps.changes.outputs.has_changes == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Configure git | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Create and switch to a new branch | |
| BRANCH_NAME="update-llm-docs-$(date +%Y%m%d%H%M%S)" | |
| git checkout -b "$BRANCH_NAME" | |
| # Commit changes | |
| git add docs/llms.txt | |
| git commit -m "docs: update llms.txt" | |
| # Push the branch | |
| git push origin "$BRANCH_NAME" | |
| # Create PR with auto-merge enabled | |
| gh pr create \ | |
| --title "docs: update llms.txt" \ | |
| --body "This PR updates the llms.txt file with the latest documentation changes." \ | |
| --head "$BRANCH_NAME" \ | |
| --base main | |
| # Enable auto-merge | |
| gh pr merge "$BRANCH_NAME" --auto --squash |