Skip to content

Commit c46228b

Browse files
committed
Test incremental update
1 parent f6c81f7 commit c46228b

File tree

3 files changed

+4
-32
lines changed

3 files changed

+4
-32
lines changed

.github/workflows/update-docs-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy to Dev Firestore
22

33
on:
44
push:
5-
branches: [ main]
5+
branches: [ anusha/pinecone-github-action ]
66

77
jobs:
88
deploy-dev:
@@ -28,5 +28,5 @@ jobs:
2828
FIRESTORE_CREDENTIALS_JSON: ${{ secrets.DEV_FIRESTORE_CREDENTIALS_JSON }}
2929
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3030
run: |
31-
python update_docs.py --mode full
31+
python update_docs.py --mode incremental
3232

.github/workflows/update-docs-prod.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,4 @@ jobs:
2929
FIRESTORE_CREDENTIALS_JSON: ${{ secrets.PROD_FIRESTORE_CREDENTIALS_JSON }}
3030
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3131
run: |
32-
python update_docs.py --mode full
33-
34-
- name: Verify deployment
35-
env:
36-
FIRESTORE_PROJECT_ID: ${{ secrets.PROD_FIRESTORE_PROJECT_ID }}
37-
FIRESTORE_CREDENTIALS_JSON: ${{ secrets.PROD_FIRESTORE_CREDENTIALS_JSON }}
38-
run: |
39-
python -c "
40-
from google.cloud import firestore
41-
from google.oauth2 import service_account
42-
import json
43-
44-
credentials_info = json.loads('$FIRESTORE_CREDENTIALS_JSON')
45-
credentials = service_account.Credentials.from_service_account_info(credentials_info)
46-
db = firestore.Client(project='$FIRESTORE_PROJECT_ID', credentials=credentials)
47-
48-
docs = db.collection('knowledge_base').stream()
49-
count = sum(1 for _ in docs)
50-
print(f'✅ Prod Firestore contains {count} documents')
51-
"
32+
python update_docs.py --mode incremental

update_docs.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
class Config:
1515
"""Configuration constants for the documentation updater."""
1616
REPO_FOLDER = "./docs"
17-
OUTPUT_FILE = "documentation_rag_chunks.json"
1817
STATE_FILE = "docs_state.json"
1918
MAX_CHUNK_SIZE = 500
2019
BATCH_SIZE = 50
@@ -55,6 +54,7 @@ def save_file_state(state: Dict[str, Dict[str, str]]) -> None:
5554
"""Save current file states."""
5655
with open(Config.STATE_FILE, 'w') as f:
5756
json.dump(state, f, indent=2)
57+
5858

5959
def get_changed_files() -> Tuple[List[str], List[str], Dict[str, str]]:
6060
"""Detect which files have changed since last run."""
@@ -385,15 +385,6 @@ def incremental_update() -> None:
385385
print("✅ Incremental update completed!")
386386

387387

388-
def save_to_json(chunks: List[Dict[str, any]]) -> None:
389-
"""Save processed chunks to JSON file for inspection."""
390-
try:
391-
with open(Config.OUTPUT_FILE, 'w', encoding='utf-8') as f:
392-
json.dump(chunks, f, indent=2, ensure_ascii=False)
393-
print(f"📄 Saved {len(chunks)} chunks to {Config.OUTPUT_FILE}")
394-
except Exception as e:
395-
print(f"⚠️ Error saving chunks to JSON: {e}")
396-
397388
def full_refresh() -> None:
398389
"""Perform full refresh - delete all and regenerate."""
399390
print("🔄 Starting full refresh...")

0 commit comments

Comments
 (0)