-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.26 KB
/
compute-embedding-and-find-similarity.yaml
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
name: Compute embedding and find similarity
on:
schedule:
- cron: '0 0 * * 3,7' # Run every Wednesday and Sunday to extend latest cache TTL
push:
branches:
- master
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Cache embeddings
uses: actions/cache@v4
with:
path: post_embedding_cache.pkl
key: embeddings-cache-${{ hashFiles('content/**/*.md') }}
restore-keys: |
embeddings-cache-
- name: Compute embedding and find similarity
run: python scripts/find_similar_posts.py
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Commit and push if changed
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add -A
git diff --quiet && git diff --staged --quiet || (git commit -m "Update embeddings" && git push)