Files
openclaw-ops/skills/github-notifications/SKILL.md

128 lines
3.3 KiB
Markdown

---
name: github-notifications
description: Check GitHub notifications for PR activity and major releases. Filters for PRs where user is mentioned/author, and major releases (v*.0.0) plus all Mirrowel/LLM-API-Key-Proxy dev builds. Tracks state to avoid duplicate alerts. Use for periodic GitHub notification checking via cron jobs or manual checks.
---
# GitHub Notifications Checker
Efficiently check GitHub notifications with smart filtering and state tracking.
## What It Does
1. **Fetches notifications** via GitHub CLI (`gh api`)
2. **Filters intelligently:**
- PRs where you're mentioned, author, or review requested
- Major releases (v*.0.0 format)
- ALL releases from `Mirrowel/LLM-API-Key-Proxy` (including dev builds)
- Excludes: rc/pre/beta/alpha/nightly releases
3. **Tracks state** to avoid duplicate notifications
4. **Returns JSON** for easy parsing
## Usage
### Basic Check
```bash
bash skills/github-notifications/scripts/check.sh
```
**Output when nothing new:**
```json
{"hasNew":false}
```
**Output with new activity:**
```json
{
"hasNew": true,
"newPRs": [
{
"repo": "openclaw/openclaw",
"title": "feat: Add cron silent mode",
"url": "https://api.github.com/repos/openclaw/openclaw/pulls/1234",
"updated": "2026-02-03T14:30:00Z",
"reason": "mention",
"id": "openclaw/openclaw#feat: Add cron silent mode"
}
],
"newReleases": [
{
"repo": "some/repo",
"title": "v2.0.0",
"updated": "2026-02-03T12:00:00Z",
"id": "some/repo@v2.0.0"
}
]
}
```
### Environment Variables
- `STATE_FILE` - Path to state tracking file (default: `memory/github-check-state.json`)
- `WORKSPACE` - Workspace directory (default: `/home/node/.openclaw/workspace`)
### State Tracking
State is stored in `memory/github-check-state.json`:
```json
{
"lastCheck": "2026-02-03T14:00:00Z",
"seenPRs": ["repo#PR Title", ...],
"seenReleases": ["repo@v1.0.0", ...]
}
```
## Integration with Cron
This skill is designed to work with OpenClaw cron jobs. The script handles all filtering and state management, only calling the LLM when there's actual content to summarize.
**Recommended cron setup:**
1. Script runs periodically (every 4 hours)
2. If `hasNew: false`, script exits silently - no LLM call, no message
3. If `hasNew: true`, cron job can format the summary and deliver it
This approach:
- ✅ Saves tokens (no LLM call when nothing new)
- ✅ Handles errors gracefully (GitHub API failures logged)
- ✅ Avoids duplicate notifications (state tracking)
- ✅ Faster execution (no LLM parsing)
## Error Handling
If GitHub API fails, returns:
```json
{
"error": "GitHub API failed",
"details": "..."
}
```
Check for `.error` field in output to detect failures.
## Auto-Dismiss Low-Value Notifications
```bash
# Dry run (see what would be dismissed)
DRY_RUN=true bash skills/github-notifications/scripts/auto-dismiss.sh
# Actually dismiss
bash skills/github-notifications/scripts/auto-dismiss.sh
```
**Auto-dismisses:**
- Title matches: nightly, preview, checkpoint, pre-release, canary, alpha, beta, snapshot
- Releases with empty release notes
**Output:**
```json
{"dismissed":3,"checked":12}
```
## Requirements
- `gh` CLI authenticated
- `jq` for JSON parsing
- GitHub token with `notifications` scope