Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/generate_llms_txt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Generate LLMs.txt File
permissions:
contents: write

on:
# Run on a schedule using cron
schedule:
# Run daily at midnight UTC
- cron: '0 0 * * *'
# Keep manual triggering ability
workflow_dispatch:

jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Generate llms.txt
run: npx -y llmstxt gen https://docs.celestia.org/sitemap.xml > public/llms.txt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized this is using the site to build it, so wouldn't build it from the new content being changed/added. so maybe this should be a cron job 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think post-merge would be even better:

image
on:
  push:
    branches:
      - main  # or 'master', whatever your default branch is
    paths:
      - docs/**       # adjust these patterns to only match relevant changes
      - .github/workflows/generate_llms_txt.yml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think /docs doesn't exist. would the post-merge work still if the site hasn't built, since it's generating it from the built site?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't noticed/focused on it. I think you are correct.
In this case, removing this "paths" key altogether should be fine, really, because the cmd is reading from the deployed website.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't know how deployment is working for now, but I am guessing it takes a moment for it to be live after merge, right?

So I got 2 decent solutions to ponder:
image
or

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do sleep for 10 mins then build it, should only take 5 mins max to build but better to be on safe side


- name: Commit and push if changed
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add public/llms.txt
git diff --quiet && git diff --staged --quiet || (git commit -m "Update llms.txt file" && git push)