-
Notifications
You must be signed in to change notification settings - Fork 138
72 lines (62 loc) · 2.19 KB
/
generate-llms-txt.yml
File metadata and controls
72 lines (62 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Generate llms.txt
on:
# Weekly schedule: Monday at 06:00 UTC
schedule:
- cron: '0 6 * * 1'
# Manual trigger via GitHub UI
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
generate:
name: Generate llms.txt files
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
- name: Build site and generate llms.txt
run: make generate-llms
env:
GENERATE_LLMS: 'true'
NODE_OPTIONS: '--max-old-space-size=4096'
DOCUSAURUS_IGNORE_SSG_WARNINGS: 'true'
- name: Check for changes
id: diff
run: |
if git diff --quiet static/llms.txt static/calico static/calico-enterprise static/calico-cloud 2>/dev/null; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create PR with updates
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
BRANCH="chore/update-llms-txt-$(date +%Y-%m-%d)"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -B "$BRANCH"
git add static/llms.txt \
static/calico/llms.txt static/calico/llms-full.txt \
static/calico-enterprise/llms.txt static/calico-enterprise/llms-full.txt \
static/calico-cloud/llms.txt static/calico-cloud/llms-full.txt
git commit -m "chore: update generated llms.txt files"
git push --force-with-lease -u origin "$BRANCH"
if ! gh pr list --head "$BRANCH" --json number --jq '.[0].number' | grep -q .; then
gh pr create \
--title "chore: update generated llms.txt files" \
--body "Automated weekly update of llms.txt and llms-full.txt files." \
--base main
fi