Skip to content

Commit 79cda70

Browse files
committed
chore: run AI models formatter
1 parent f000cf6 commit 79cda70

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Run AI models formatter (temporary)
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
format-ai-models:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout PR branch
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.pull_request.head.ref }}
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 24
22+
cache: npm
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Apply model answers
28+
shell: bash
29+
run: |
30+
python <<'PY'
31+
from pathlib import Path
32+
import re
33+
34+
source = Path('.github/workflows/format-ai-models-temp.yml').read_text()
35+
match = re.search(r"replacement = r'''(.*?)'''", source, flags=re.S)
36+
if not match:
37+
raise SystemExit('Replacement section not found')
38+
39+
replacement = match.group(1)
40+
path = Path('src/pages/ai/index.md')
41+
text = path.read_text()
42+
pattern = re.compile(r'(?ms)^### Модели и провайдеры\n.*?(?=^### AI-инструменты разработки\n)')
43+
updated, count = pattern.subn(lambda _: replacement, text)
44+
if count != 1:
45+
raise SystemExit(f'Expected one models section, got {count}')
46+
path.write_text(updated)
47+
PY
48+
49+
- name: Format AI page
50+
run: npx prettier --write src/pages/ai/index.md
51+
52+
- name: Commit formatted page
53+
run: |
54+
if git diff --quiet; then
55+
exit 0
56+
fi
57+
git config user.name "github-actions[bot]"
58+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
59+
git add src/pages/ai/index.md
60+
git commit -m "docs: expand AI model and provider answers"
61+
git push origin HEAD:${{ github.event.pull_request.head.ref }}

0 commit comments

Comments
 (0)