Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-node@v6
with:
node-version: 24.x
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build
Expand Down
58 changes: 38 additions & 20 deletions .github/workflows/train-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,68 @@ on:
schedule:
- cron: '0 2 * * 0' # Run at 2AM UTC every Sunday

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
name: Train Model
steps:
- name: Install Git LFS
run: sudo apt-get update && sudo apt-get install git-lfs && git lfs install
run: sudo apt-get update && sudo apt-get install -y git-lfs && git lfs install

- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
lfs: true
token: ${{ secrets.PAT_TOKEN }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- uses: oven-sh/setup-bun@v2

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'pnpm'

- name: Install dependencies
run: pnpm install && pnpm approve-builds && pnpm add faiss-node --allow-build=faiss-node && pnpm rebuild faiss-node
run: bun install

- name: Train model from READMEs
run: node scripts/train_model.mjs
run: bun scripts/train_model.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
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
if: steps.git-check.outputs.changes == 'true'
run: |
git config --global user.name "Martin DONADIEU"
git config --global user.email "martindonadieu@gmail.com"
git lfs track "loadedVectorStore/*.json"
git lfs track "loadedVectorStore/*.index"
git add .gitattributes
git add loadedVectorStore/*.json loadedVectorStore/*.index
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 "Commit generated files"
git push origin main -f
git commit -m "chore: update trained model [skip ci]" \
-m "Automated update from train-model 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
working-directory: ./

- name: Report no changes
if: steps.git-check.outputs.changes != 'true'
run: echo "No changes to commit - trained model is up to date"
58 changes: 38 additions & 20 deletions .github/workflows/write-tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,68 @@ on:
schedule:
- cron: '0 3 * * 0' # Run at 3AM UTC every Sunday

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
name: Write Tutorials
steps:
- name: Install Git LFS
run: sudo apt-get update && sudo apt-get install git-lfs && git lfs install
run: sudo apt-get update && sudo apt-get install -y git-lfs && git lfs install

- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
lfs: true
token: ${{ secrets.PAT_TOKEN }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- uses: oven-sh/setup-bun@v2

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: 'pnpm'

- name: Install dependencies
run: pnpm install && pnpm approve-builds && pnpm add faiss-node --allow-build=faiss-node && pnpm rebuild faiss-node
run: bun install

- name: Generate tutorials
run: node scripts/generate_tutorials.mjs
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
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
if: steps.git-check.outputs.changes == 'true'
run: |
git config --global user.name "Martin DONADIEU"
git config --global user.email "martindonadieu@gmail.com"
git lfs track "loadedVectorStore/*.json"
git lfs track "loadedVectorStore/*.index"
git add .gitattributes
git add loadedVectorStore/*.json loadedVectorStore/*.index
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 "Commit generated files"
git push origin main -f
git commit -m "chore: update generated tutorials [skip ci]" \
-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
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"
5 changes: 4 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@
"tsx": "^4.19.4",
"typescript": "^5.7.3",
"zod": "^3.24.2"
}
},
"trustedDependencies": [
"faiss-node"
]
}
Loading