Skip to content

Update Ollama Insights #41

Update Ollama Insights

Update Ollama Insights #41

Workflow file for this run

name: Update Ollama Insights
on:
schedule:
- cron: "0 0 * * *" # daily schedule
workflow_dispatch:
jobs:
update-insights:
runs-on: ubuntu-latest
services:
ollama:
image: ollama/ollama
ports:
- 11434:11434
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }} # Use PAT instead of default token
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt
- name: Wait for Ollama to be ready
run: |
for i in {1..30}; do
curl -s http://localhost:11434/api/tags && break
sleep 2
done
- name: Pull Model
run: |
curl -X POST http://localhost:11434/api/pull -d '{"name": "mistral"}'
- name: Run Python script to update db.json, design, and index.html
run: python main.py
- name: Commit and Push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
if ! git diff --cached --exit-code; then
git commit -m "Update insights $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/ergate-ai/ai-speaks.git main
else
echo "No changes to commit."
fi