Skip to content

Commit e2374a3

Browse files
committed
news: auto-push heartbeat publications
1 parent 8e57a66 commit e2374a3

3 files changed

Lines changed: 44 additions & 3 deletions

File tree

news_pipeline/HEARTBEAT_RUNBOOK.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ cd /Volumes/KIOXIA/blog-project && bash news_pipeline/scripts/heartbeat-cycle.sh
2222
2. `news-pipeline process`
2323
3. `news-pipeline queue summary`
2424
4. `news-pipeline autopublish --limit 1 --min-score 0.68`
25-
5. `news-pipeline queue review`
26-
6. `news-pipeline queue list --status new`
25+
5. autopublish varsa ilgili dosyayı git commit + push et
26+
6. `news-pipeline queue review`
27+
7. `news-pipeline queue list --status new`
2728

2829
## Heartbeat karar kuralı
2930

@@ -72,5 +73,6 @@ Uzun rapor dökme.
7273

7374
Bu runbook'ta publish kararı Nyx'in editoryal değerlendirmesinden sonra heartbeat içinde gelebilir.
7475
Uygun aday bulunduğunda kayıt doğrudan canlı `src/content/anlikHaber/` klasörüne yazılır.
76+
Heartbeat script'i bu canlı dosyayı ardından otomatik git commit + push ile repoya gönderir.
7577
Ama `manual-review` veya kırmızı bayraklı kayıtlar otomatik publish edilmez.
7678
İlk güvenli modda heartbeat başına en fazla 1 kayıt publish edilir.

news_pipeline/scripts/heartbeat-cycle.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ echo "--- HEARTBEAT SUMMARY ---"
1313
news-pipeline queue summary || true
1414

1515
echo "--- AUTOPUBLISH ---"
16-
news-pipeline autopublish --limit 1 --min-score 0.68 || true
16+
autopublish_output="$(news-pipeline autopublish --limit 1 --min-score 0.68 || true)"
17+
printf '%s\n' "$autopublish_output"
18+
19+
mapfile -t autopublished_paths < <(printf '%s\n' "$autopublish_output" | sed -n 's/^autopublished: .* -> \(\/.*\.md\)$/\1/p')
20+
if [ "${#autopublished_paths[@]}" -gt 0 ]; then
21+
echo "--- GIT PUSH ---"
22+
bash news_pipeline/scripts/push-autopublished.sh "${autopublished_paths[@]}"
23+
fi
1724

1825
echo "--- MANUAL REVIEW ---"
1926
news-pipeline queue review | sed -n '1,5p' || true
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT="/Volumes/KIOXIA/blog-project"
5+
cd "$ROOT"
6+
7+
if [ "$#" -eq 0 ]; then
8+
exit 0
9+
fi
10+
11+
paths=()
12+
for path in "$@"; do
13+
if [ -f "$path" ]; then
14+
paths+=("$path")
15+
fi
16+
done
17+
18+
if [ "${#paths[@]}" -eq 0 ]; then
19+
exit 0
20+
fi
21+
22+
git add -- "${paths[@]}"
23+
24+
if git diff --cached --quiet; then
25+
exit 0
26+
fi
27+
28+
first_slug="$(basename "${paths[0]}" .md)"
29+
commit_message="news: autopublish ${first_slug}"
30+
31+
git commit -m "$commit_message"
32+
git push origin main

0 commit comments

Comments
 (0)