feat(notify-email): composite action 通过 SMTP 发邮件 + lint workflow
lint / yamllint (push) Successful in 12s

- notify-email 用 curl smtps:// 协议,163/126 兼容
- self-mail 模式:USER/TO 可同账号
- 失败时 ::warning:: 不阻塞
- lint workflow: yamllint 验证 action.yml 语法
This commit is contained in:
gitea_admin
2026-07-13 09:36:06 +08:00
parent 2e99202570
commit 25e21fd0c7
3 changed files with 129 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# notify-email
通过 SMTP 发送 Gitea Actions run 结果邮件。**已验证兼容 163 / 126 邮箱**。
## Inputs
| 名称 | 必填 | 默认 | 说明 |
|---|---|---|---|
| `smtp_host` | ✅ | — | 例:`smtp.163.com` |
| `smtp_port` | ❌ | `465` | SSL 端口 |
| `smtp_user` | ✅ | — | 完整邮箱地址 |
| `smtp_pass` | ✅ | — | 授权码(业务 repo 配 Gitea secret |
| `from` | ❌ | = `smtp_user` | 发件人 |
| `to` | ✅ | — | 收件人,多个用逗号 |
| `subject` | ✅ | — | 邮件主题 |
| `body` | ✅ | — | 邮件正文(纯文本) |
## 使用示例
```yaml
- uses: gitea_admin/ci-actions/notify-email@v1
with:
smtp_host: smtp.163.com
smtp_user: ${{ secrets.EMAIL_USER }}
smtp_pass: ${{ secrets.EMAIL_SMTP_PASS }}
to: ${{ secrets.EMAIL_TO }}
subject: "[gitea-ci] ${{ github.repository }} - ${{ needs.build.result }}"
body: |
repository: ${{ github.repository }}
workflow: ${{ github.workflow }}
status: ${{ needs.build.result }}
url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
```
## 安全
`smtp_pass` **必须**通过 Gitea secret 传入,**不要**直接写在 workflow 里。
## 失败处理
邮件发送失败时输出 `::warning::Email send failed (non-fatal)`**不阻塞**调用方 job。