GitHub repository started notify 💕
当有人标星(Star)你的仓库时,发送一封包含标星者信息(头像、昵称、个人主页)及当前 Star 总数的精美邮件通知。
- 实时通知:利用 GitHub Actions 的
watch事件触发。 - 详细信息:邮件包含标星者的头像、用户名、个人资料链接。
- 统计数据:显示当前仓库的 Star 总数。
- 自动获取邮箱:如果未指定接收邮箱,尝试自动获取仓库所有者的公开邮箱。
在你的仓库中创建文件 .github/workflows/started_notify.yml,并填入以下内容:
name: Star Notify
on:
watch:
types: [ started ]
jobs:
Notify:
runs-on: ubuntu-latest
steps:
- name: Download Script
run: |
wget https://raw.githubusercontent.com/foyoux/started-notify/main/.github/workflows/started_notify.py#${{github.run_id}}
- name: Send Email
env:
SMTP_HOST: ${{ secrets.NOTIFY_SMTP_HOST }}
SMTP_PORT: ${{ secrets.NOTIFY_SMTP_PORT }}
SMTP_USER: ${{ secrets.NOTIFY_SMTP_USER }}
SMTP_PASSWORD: ${{ secrets.NOTIFY_SMTP_PASSWORD }}
STARGAZER_LOGIN: ${{ github.actor }}
run: |
python started_notify.py ${{github.token}} "${{secrets.NOTIFY_EMAIL}}"进入仓库的 Settings -> Secrets and variables -> Actions,添加以下 Repository secrets:
| Secret Name | 说明 | 示例 / 备注 |
|---|---|---|
NOTIFY_SMTP_HOST |
SMTP 服务器地址 | smtp.qq.com (QQ邮箱), smtp.gmail.com |
NOTIFY_SMTP_PORT |
SMTP 端口 (SSL) | 465 |
NOTIFY_SMTP_USER |
发件人邮箱账号 | example@qq.com |
NOTIFY_SMTP_PASSWORD |
邮箱授权码/密码 | QQ邮箱需使用授权码 |
NOTIFY_EMAIL |
(可选) 接收通知的邮箱 | 如果不设置,将尝试发送给仓库所有者的公开邮箱 |
