-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-trending.sh
More file actions
executable file
·74 lines (59 loc) · 2.12 KB
/
github-trending.sh
File metadata and controls
executable file
·74 lines (59 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# GitHub Trending 监控脚本
# 自动追踪 OpenClaw 相关的热门项目
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# 日志文件
LOG_DIR="${LOG_DIR:-/var/log/miaoquai}"
mkdir -p "$LOG_DIR"
LOG_FILE="$LOG_DIR/trending-$(date +%Y-%m-%d).log"
log() {
echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}
log "${BLUE}🦞 GitHub Trending 监控启动${NC}"
log "${YELLOW}追踪关键词: openclaw, ai-agent, skills${NC}"
# 搜索 OpenClaw 相关项目
search_openclaw() {
log "\n${GREEN}=== OpenClaw 核心项目 ===${NC}"
gh search repos "openclaw" --sort stars --limit 5 --json fullName,description,stargazersCount,url 2>/dev/null | \
jq -r '.[] | "⭐ \(.stargazersCount) - \(.fullName): \(.description)"' | \
while read line; do log "$line"; done
log "\n${GREEN}=== OpenClaw Skills 项目 ===${NC}"
gh search repos "openclaw skill" --sort stars --limit 5 --json fullName,description,stargazersCount,url 2>/dev/null | \
jq -r '.[] | "⭐ \(.stargazersCount) - \(.fullName): \(.description)"' | \
while read line; do log "$line"; done
log "\n${GREEN}=== AI Agent 相关项目 ===${NC}"
gh search repos "ai-agent" --sort stars --limit 5 --json fullName,description,stargazersCount,url 2>/dev/null | \
jq -r '.[] | "⭐ \(.stargazersCount) - \(.fullName): \(.description)"' | \
while read line; do log "$line"; done
}
# 检查是否安装了必要的工具
check_dependencies() {
if ! command -v gh &> /dev/null; then
log "${RED}错误: gh (GitHub CLI) 未安装${NC}"
exit 1
fi
if ! command -v jq &> /dev/null; then
log "${RED}错误: jq 未安装${NC}"
exit 1
fi
}
# 主函数
main() {
check_dependencies
# 检查 GitHub 登录状态
if ! gh auth status &> /dev/null; then
log "${RED}错误: 未登录 GitHub${NC}"
log "请运行: gh auth login"
exit 1
fi
search_openclaw
log "\n${GREEN}✅ 监控完成${NC}"
log "日志文件: $LOG_FILE"
}
main "$@"