Skip to content

πŸ› fix cache 7-day TTL delete issue #56

πŸ› fix cache 7-day TTL delete issue

πŸ› fix cache 7-day TTL delete issue #56

name: Compute embedding and find similarity

Check failure on line 1 in .github/workflows/compute-embedding-and-find-similarity.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/compute-embedding-and-find-similarity.yaml

Invalid workflow file

invalid `cron` attribute "0 0 * * 3,7"
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)