-
-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (65 loc) · 2.31 KB
/
Copy pathwrite-tutorials.yml
File metadata and controls
76 lines (65 loc) · 2.31 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
name: Write Tutorials
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 0' # Run at 3AM UTC every Sunday
permissions:
contents: write
actions: write
jobs:
deploy:
runs-on: ubuntu-latest
name: Write Tutorials
steps:
- name: Install Git LFS
run: sudo apt-get update && sudo apt-get install -y git-lfs && git lfs install
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- uses: oven-sh/setup-bun@v2
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Install dependencies
run: bun install
- name: Generate tutorials
run: bun scripts/generate_tutorials.mjs
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Check for changes
id: git-check
run: |
if git diff --quiet && git diff --cached --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit generated files
if: steps.git-check.outputs.changes == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git lfs track "loadedVectorStore/*.json" 2>/dev/null || true
git lfs track "loadedVectorStore/*.index" 2>/dev/null || true
git add .gitattributes 2>/dev/null || true
git add loadedVectorStore/*.json loadedVectorStore/*.index 2>/dev/null || true
git add -A
git commit -m "chore: update generated tutorials" \
-m "Automated update from write-tutorials workflow" \
-m "Run ID: ${{ github.run_id }}"
git pull --rebase origin main || {
echo "Rebase conflict detected, aborting and retrying..."
git rebase --abort
git pull --no-rebase origin main
exit 1
}
git push origin main
gh workflow run deploy.yml --ref main
working-directory: ./
- name: Report no changes
if: steps.git-check.outputs.changes != 'true'
run: echo "No changes to commit - generated tutorials are up to date"