Skip to content
Open
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
1 change: 1 addition & 0 deletions codespell-ignore.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
assertIn
nd
22 changes: 22 additions & 0 deletions planthood-site/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# LLM Provider Configuration
# Choose one: openai, anthropic, gemini
LLM_PROVIDER=openai

# API Keys (only set the one matching your provider)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=...

# LLM Model Configuration (optional, defaults provided)
# OPENAI_MODEL=gpt-4o-mini
# ANTHROPIC_MODEL=claude-3-5-haiku-20241022
# GEMINI_MODEL=gemini-1.5-flash

# Scraper Configuration
# USER_AGENT=Mozilla/5.0 (compatible; PlanthoodScraper/1.0)
# REQUEST_DELAY=1.0

# Parser Configuration
# CACHE_DIR=data/.cache
# SKIP_CACHE=false
# MAX_RETRIES=3
113 changes: 113 additions & 0 deletions planthood-site/.github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build and Deploy to GitHub Pages

on:
# Run weekly on Mondays at 3 AM UTC
schedule:
- cron: '0 3 * * 1'

# Allow manual triggering
workflow_dispatch:

# Run on push to main (for testing)
push:
branches:
- main

# Required for GitHub Pages deployment and committing data
permissions:
contents: write
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'planthood-site/requirements.txt'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'planthood-site/site/package-lock.json'

- name: Install Python dependencies
working-directory: planthood-site
run: |
pip install -r requirements.txt

- name: Install Node dependencies
working-directory: planthood-site/site
run: |
npm ci

- name: Run scraper
working-directory: planthood-site
run: |
python scraper/scrape.py
continue-on-error: true

- name: Run LLM parser
working-directory: planthood-site
env:
LLM_PROVIDER: ${{ secrets.LLM_PROVIDER || 'openai' }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }}
ANTHROPIC_MODEL: ${{ secrets.ANTHROPIC_MODEL }}
GEMINI_MODEL: ${{ secrets.GEMINI_MODEL }}
run: |
python parser/parse.py
continue-on-error: true

- name: Run scheduler
working-directory: planthood-site
run: |
python scheduler/schedule.py
continue-on-error: true

- name: Build Next.js site
working-directory: planthood-site/site
run: |
npm run build

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './planthood-site/site/out'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Commit updated data (if changed)
working-directory: planthood-site
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A data/
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update recipe data [skip ci]" && git push)
continue-on-error: true
50 changes: 50 additions & 0 deletions planthood-site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
.venv/
*.egg-info/
dist/
build/

# Node
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# Next.js
.next/
out/
site/.next/
site/out/

# Data (committed selectively)
data/raw_recipes.json
data/recipes_parsed.json
data/recipes_with_schedule.json
data/.cache/

# Environment
.env
.env.local
.env.*.local

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Build artifacts
*.log
Loading
Loading