Repository navigation
81 lines (71 loc) · 2.29 KB
/
Copy pathdocs-update-llms.yaml
File metadata and controls
81 lines (71 loc) · 2.29 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
73
74
75
76
77
78
79
80
81
name: Docs / Update llms files
permissions:
contents: write
on:
push:
branches:
- docs/release
paths:
- 'docs/docs/**'
- 'skills/**'
workflow_dispatch: # Allow manual trigger
jobs:
update-llms:
# This runs the same memory-intensive Docusaurus build as docs publishing.
runs-on: spacetimedb-linux
env:
NODE_OPTIONS: --max-old-space-size=8192
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: docs/release
- name: Set up Node.js
uses: actions/setup-node@v3
with:
# Minimum 22.x release with the eMudhra CA fix.
node-version: '22.23.4'
- uses: ./.github/actions/setup-pnpm
with:
run_install: true
- name: Install dependencies
working-directory: docs
run: pnpm install
- name: Docusaurus build
working-directory: docs
run: pnpm build
- name: Generate llms files
working-directory: docs
run: node scripts/generate-llms.mjs
- name: Commit updated llms files
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const fs = require('node:fs');
const branch = 'docs/release';
const path = 'docs/static/llms.md';
if (await exec.exec('git', ['diff', '--quiet', '--', path], {
ignoreReturnCode: true,
}) === 0) return;
await github.graphql(`
mutation($input: CreateCommitOnBranchInput!) {
createCommitOnBranch(input: $input) { commit { oid } }
}
`, {
input: {
branch: {
repositoryNameWithOwner: `${context.repo.owner}/${context.repo.repo}`,
branchName: branch,
},
expectedHeadOid: (await exec.getExecOutput(
'git', ['rev-parse', 'HEAD']
)).stdout.trim(),
message: { headline: 'Update llms files from docs build' },
fileChanges: {
additions: [{
path,
contents: fs.readFileSync(path, 'base64'),
}],
},
},
});