#!/bin/bash # Cron wrapper for GitHub notifications # 1. Auto-dismisses low-value notifications (nightlies, previews, empty releases) # 2. Checks remaining notifications and formats for human consumption set -e WORKSPACE="${WORKSPACE:-/home/node/.openclaw/workspace}" cd "$WORKSPACE" # First: auto-dismiss low-value notifications bash skills/github-notifications/scripts/auto-dismiss.sh >/dev/null 2>&1 || true # Then: run the checker RESULT=$(bash skills/github-notifications/scripts/check.sh) # Check for errors if echo "$RESULT" | jq -e '.error' > /dev/null 2>&1; then ERROR_MSG=$(echo "$RESULT" | jq -r '.error') ERROR_DETAILS=$(echo "$RESULT" | jq -r '.details') echo "❌ **GitHub Check Failed**" echo "" echo "Error: $ERROR_MSG" echo "\`\`\`" echo "$ERROR_DETAILS" | head -20 echo "\`\`\`" exit 0 fi # Check if there's new activity HAS_NEW=$(echo "$RESULT" | jq -r '.hasNew') if [ "$HAS_NEW" != "true" ]; then # Nothing new - stay completely silent (no output = no message) exit 0 fi # Format and output the summary echo "🔔 **GitHub Activity Update**" echo "" # Process PRs PR_COUNT=$(echo "$RESULT" | jq '.newPRs | length') if [ "$PR_COUNT" -gt 0 ]; then echo "**Pull Requests ($PR_COUNT new):**" echo "$RESULT" | jq -r '.newPRs[] | "- **\(.repo)** #\(.title)\n Updated: \(.updated) | Reason: \(.reason)"' echo "" fi # Process Releases RELEASE_COUNT=$(echo "$RESULT" | jq '.newReleases | length') if [ "$RELEASE_COUNT" -gt 0 ]; then echo "**Releases ($RELEASE_COUNT new):**" echo "$RESULT" | jq -r '.newReleases[] | "- **\(.repo)** `\(.title)`\n Released: \(.updated)"' fi