Skip to content

Commit f3d19ed

Browse files
committed
feat: Discord notification on evolution complete
- Sends embed with Day, PR, Duration, Journal excerpt - Uses DISCORD_WEBHOOK_URL secret - Works silently if secret not set
1 parent c885dfa commit f3d19ed

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/evolve.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
ITERATE_MODEL: kimi-k2.5
4949
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
5152
run: |
5253
bash scripts/evolution/evolve.sh
5354

scripts/evolution/evolve.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,32 @@ log "Day: $DAY"
322322
log "Branch: $BRANCH"
323323
log "PR: #${PR_NUMBER:-none}"
324324
log "Duration: ${SESSION_DURATION}s"
325+
326+
# ── Discord notification ──
327+
if [[ -n "${DISCORD_WEBHOOK_URL:-}" ]]; then
328+
log "Sending Discord notification..."
329+
330+
# Get journal entry for this day
331+
JOURNAL_ENTRY=$(grep -A3 "^## Day $DAY" docs/JOURNAL.md 2>/dev/null | head -4 || echo "No journal entry")
332+
333+
DISCORD_MSG="{
334+
\"embeds\": [{
335+
\"title\": \"🧬 Evolution Day $DAY Complete\",
336+
\"color\": 5814783,
337+
\"fields\": [
338+
{\"name\": \"PR\", \"value\": \"${PR_NUMBER:-none}\", \"inline\": true},
339+
{\"name\": \"Duration\", \"value\": \"${SESSION_DURATION}s\", \"inline\": true},
340+
{\"name\": \"Commits\", \"value\": \"$(git log --oneline origin/main..HEAD 2>/dev/null | wc -l | tr -d ' ')\", \"inline\": true},
341+
{\"name\": \"Journal\", \"value\": \"$(echo "$JOURNAL_ENTRY" | head -3 | tr '\n' ' ' | cut -c1-100)\"}
342+
],
343+
\"footer\": {\"text\": \"iterate-evolve[bot]\"},
344+
\"timestamp\": \"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\"
345+
}]
346+
}"
347+
348+
curl -s -H "Content-Type: application/json" \
349+
-d "$DISCORD_MSG" \
350+
"$DISCORD_WEBHOOK_URL" >/dev/null 2>&1 || log "Discord notification failed"
351+
352+
log "Discord notification sent"
353+
fi

0 commit comments

Comments
 (0)