mirror of
https://github.com/nubenetes/awesome-kubernetes.git
synced 2026-07-12 09:51:00 +00:00
feat: cache news_digest.json by date to avoid re-calling Gemini on re-runs
Publisher and weekly digest workflows now restore news_digest.json from GitHub Actions cache using key news-digest-YYYY-MM-DD. If cache hits (same-day re-run after publisher failure), the Gemini digest step is skipped entirely — saving ~20min and Gemini API credits. Cache is saved immediately after successful generation and expires automatically after 7 days (GitHub Actions cache policy). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
.github/workflows/04.1.agentic_v2_publish.yml
vendored
28
.github/workflows/04.1.agentic_v2_publish.yml
vendored
@@ -60,7 +60,20 @@ jobs:
|
||||
- name: Installation of Dependencies
|
||||
run: |
|
||||
pip install --no-cache-dir pydantic PyGithub httpx fake-useragent pytz python-dotenv pyyaml tenacity
|
||||
|
||||
|
||||
- name: Get current date for digest cache key
|
||||
id: digest-date
|
||||
run: echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Restore News Digest Cache
|
||||
id: cache-digest
|
||||
uses: actions/cache/restore@v5
|
||||
with:
|
||||
path: data/news_digest.json
|
||||
key: news-digest-${{ steps.digest-date.outputs.date }}
|
||||
restore-keys: |
|
||||
news-digest-
|
||||
|
||||
- name: Execute Video Portal Generator
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
@@ -87,14 +100,27 @@ jobs:
|
||||
python -u -m src.enrichment || echo "Enrichment pipeline skipped (no token or error)"
|
||||
|
||||
- name: Generate News Digest
|
||||
if: steps.cache-digest.outputs.cache-hit != 'true'
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
GEMINI_API_KEY_1: ${{ secrets.GEMINI_API_KEY_1 }}
|
||||
GEMINI_API_KEY_2: ${{ secrets.GEMINI_API_KEY_2 }}
|
||||
run: |
|
||||
python -u -m src.news_digest || echo "News digest generation skipped (no API key or error)"
|
||||
|
||||
- name: Generate RSS Feed
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
run: |
|
||||
python -u -m src.rss_generator || echo "RSS generation skipped"
|
||||
|
||||
- name: Save News Digest Cache
|
||||
if: steps.cache-digest.outputs.cache-hit != 'true' && hashFiles('data/news_digest.json') != ''
|
||||
uses: actions/cache/save@v5
|
||||
with:
|
||||
path: data/news_digest.json
|
||||
key: news-digest-${{ steps.digest-date.outputs.date }}
|
||||
|
||||
- name: Run V2 Publisher (Render-Only)
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
26
.github/workflows/09.weekly_digest.yml
vendored
26
.github/workflows/09.weekly_digest.yml
vendored
@@ -33,13 +33,39 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
- name: Get current date for digest cache key
|
||||
id: digest-date
|
||||
run: echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Restore News Digest Cache
|
||||
id: cache-digest
|
||||
uses: actions/cache/restore@v5
|
||||
with:
|
||||
path: data/news_digest.json
|
||||
key: news-digest-${{ steps.digest-date.outputs.date }}
|
||||
restore-keys: |
|
||||
news-digest-
|
||||
|
||||
- name: Generate News Digest (Gemini)
|
||||
if: steps.cache-digest.outputs.cache-hit != 'true'
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
GEMINI_API_KEY_1: ${{ secrets.GEMINI_API_KEY_1 }}
|
||||
GEMINI_API_KEY_2: ${{ secrets.GEMINI_API_KEY_2 }}
|
||||
run: |
|
||||
python -u -m src.news_digest
|
||||
|
||||
- name: Save News Digest Cache
|
||||
if: steps.cache-digest.outputs.cache-hit != 'true' && hashFiles('data/news_digest.json') != ''
|
||||
uses: actions/cache/save@v5
|
||||
with:
|
||||
path: data/news_digest.json
|
||||
key: news-digest-${{ steps.digest-date.outputs.date }}
|
||||
|
||||
- name: Generate RSS Feed
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
run: |
|
||||
python -u -m src.rss_generator || echo "RSS generation skipped"
|
||||
|
||||
- name: Render V2 Portal (Digest Pages Only)
|
||||
|
||||
Reference in New Issue
Block a user