Skip to content

Commit 1ddbf11

Browse files
committed
newsletter cleanup test
1 parent 087a6af commit 1ddbf11

File tree

24 files changed

+5603
-59342
lines changed

24 files changed

+5603
-59342
lines changed

.github/workflows/process-newsletters.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ jobs:
3434
run: |
3535
pip install beautifulsoup4 pyyaml git-filter-repo
3636
37+
- name: Install AI dependencies
38+
if: env.AI_SANDBOX_KEY != ''
39+
env:
40+
AI_SANDBOX_KEY: ${{ secrets.AI_SANDBOX_KEY }}
41+
run: pip install portkey-ai
42+
3743
- name: Check for files to process
3844
id: check_files
3945
run: |
@@ -55,6 +61,22 @@ jobs:
5561
run: |
5662
python scripts/process_inbox.py
5763
64+
- name: AI post-process newsletters
65+
if: steps.check_files.outputs.has_files == 'true' && env.AI_SANDBOX_KEY != ''
66+
env:
67+
AI_SANDBOX_KEY: ${{ secrets.AI_SANDBOX_KEY }}
68+
run: |
69+
# Find newly added newsletter files
70+
FILES=$(git diff --name-only --diff-filter=A -- '_newsletters/*/index.md' 2>/dev/null || true)
71+
if [ -n "$FILES" ]; then
72+
echo "AI post-processing $(echo "$FILES" | wc -l | tr -d ' ') newsletter(s)..."
73+
echo "$FILES" | while read -r f; do
74+
python scripts/ai_post_process.py "$f" --verbose || echo "WARNING: AI post-processing failed for $f"
75+
done
76+
else
77+
echo "No new newsletters to post-process"
78+
fi
79+
5880
- name: Commit processed newsletters
5981
if: steps.check_files.outputs.has_files == 'true'
6082
run: |

.github/workflows/receive-newsletter.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
- name: Install dependencies
2929
run: pip install beautifulsoup4
3030

31+
- name: Install AI dependencies
32+
if: env.AI_SANDBOX_KEY != ''
33+
env:
34+
AI_SANDBOX_KEY: ${{ secrets.AI_SANDBOX_KEY }}
35+
run: pip install portkey-ai
36+
3137
- name: Check for duplicate
3238
id: dedup
3339
env:
@@ -74,6 +80,17 @@ jobs:
7480
ensure_archive_pages(date)
7581
PYEOF
7682
83+
- name: AI post-process newsletter
84+
if: steps.dedup.outputs.is_duplicate == 'false' && env.AI_SANDBOX_KEY != ''
85+
env:
86+
AI_SANDBOX_KEY: ${{ secrets.AI_SANDBOX_KEY }}
87+
SLUG: ${{ github.event.client_payload.slug }}
88+
run: |
89+
FILEPATH="_newsletters/${SLUG}/index.md"
90+
if [ -f "$FILEPATH" ]; then
91+
python scripts/ai_post_process.py "$FILEPATH" --verbose || echo "WARNING: AI post-processing failed"
92+
fi
93+
7794
- name: Commit and push
7895
if: steps.dedup.outputs.is_duplicate == 'false'
7996
run: |

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help serve-local serve-preview serve-prod build-preview build-prod clean docker-local docker-preview docker-prod backfill backfill-dry-run
1+
.PHONY: help serve-local serve-preview serve-prod build-preview build-prod clean docker-local docker-preview docker-prod backfill backfill-dry-run ai-cleanup ai-cleanup-dry-run
22

33
JEKYLL?=bundle exec jekyll
44
PYTHON?=.venv/bin/python
@@ -53,3 +53,10 @@ backfill:
5353

5454
backfill-dry-run:
5555
$(PYTHON) scripts/backfill_newsletters.py --dir backfill/ --dry-run
56+
57+
# AI post-processing (requires AI_SANDBOX_KEY env var and portkey-ai)
58+
ai-cleanup:
59+
$(PYTHON) scripts/ai_post_process.py _newsletters/*/index.md
60+
61+
ai-cleanup-dry-run:
62+
$(PYTHON) scripts/ai_post_process.py _newsletters/*/index.md --dry-run

_newsletters/10.01-Happy_2022-010822/index.md

Lines changed: 577 additions & 6898 deletions
Large diffs are not rendered by default.

_newsletters/10.02-Olli_RiP-011522/index.md

Lines changed: 554 additions & 7292 deletions
Large diffs are not rendered by default.

_newsletters/10.03-Guilty-012122/index.md

Lines changed: 593 additions & 7319 deletions
Large diffs are not rendered by default.

_newsletters/10.04-Pioneers-012122/index.md

Lines changed: 645 additions & 8293 deletions
Large diffs are not rendered by default.

_newsletters/10.05-Invitation-020422/index.md

Lines changed: 656 additions & 8036 deletions
Large diffs are not rendered by default.

_newsletters/10.06-$5M-021122/index.md

Lines changed: 265 additions & 2309 deletions
Large diffs are not rendered by default.

_newsletters/10.08-STOP-022622/index.md

Lines changed: 207 additions & 2030 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)