|
| 1 | +name: Update llms.txt |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'docs/**/*.md' |
| 8 | + - 'zensical.toml' |
| 9 | + - 'scripts/build_llms_txt.py' |
| 10 | + pull_request: |
| 11 | + branches: [main] |
| 12 | + paths: |
| 13 | + - 'docs/**/*.md' |
| 14 | + - 'zensical.toml' |
| 15 | + - 'scripts/build_llms_txt.py' |
| 16 | + pull_request_target: |
| 17 | + types: [labeled] |
| 18 | + paths: |
| 19 | + - 'docs/**/*.md' |
| 20 | + - 'zensical.toml' |
| 21 | + - 'scripts/build_llms_txt.py' |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write |
| 25 | + |
| 26 | +jobs: |
| 27 | + update-llms-txt: |
| 28 | + if: | |
| 29 | + github.event_name == 'push' || |
| 30 | + !github.event.pull_request.head.repo.fork || |
| 31 | + github.actor == 'koxudaxi' || |
| 32 | + github.actor == 'gaborbernat' || |
| 33 | + github.actor == 'ilovelinux' || |
| 34 | + (github.event_name == 'pull_request_target' && github.event.label.name == 'safe-to-fix' && |
| 35 | + (github.event.sender.login == 'koxudaxi' || |
| 36 | + github.event.sender.login == 'gaborbernat' || |
| 37 | + github.event.sender.login == 'ilovelinux')) |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + ref: ${{ github.event.pull_request.head.ref }} |
| 45 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + if: github.event_name == 'push' || github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + ref: ${{ github.event.pull_request.head.ref || github.ref }} |
| 51 | + repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} |
| 52 | + token: ${{ secrets.PAT }} |
| 53 | + - name: Install the latest version of uv |
| 54 | + uses: astral-sh/setup-uv@v5 |
| 55 | + - name: Install tox |
| 56 | + run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv |
| 57 | + - name: Setup environment |
| 58 | + run: tox run -vv --notest --skip-missing-interpreters false -e llms-txt |
| 59 | + env: |
| 60 | + UV_PYTHON_PREFERENCE: "only-managed" |
| 61 | + - name: Build llms.txt |
| 62 | + run: .tox/llms-txt/bin/python scripts/build_llms_txt.py |
| 63 | + - name: Commit and push if changed |
| 64 | + if: github.event_name == 'push' || github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository |
| 65 | + run: | |
| 66 | + git config user.name "github-actions[bot]" |
| 67 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 68 | + git add docs/llms.txt docs/llms-full.txt |
| 69 | + git diff --staged --quiet || git commit -m "docs: update llms.txt files |
| 70 | +
|
| 71 | + Generated by GitHub Actions" |
| 72 | + git push |
0 commit comments