Files
beforegolive 3f9fa1f9c9
lint / yamllint (push) Successful in 5m27s
fix(notify-email): 修 smtps:// 下 -H + --upload-file - 不生效的 bug
curl 在 smtps:// 模式下,'-H' 头部和 '--upload-file -' body 同时给时,
实际 DATA 段几乎为空(实测 97 bytes 上行 vs 完整邮件 289 bytes),
收件人看不到 Subject 和 body。

改为:把整封邮件(From/To/Subject/MIME-Version/Content-Type/Date + 空行 +
body)拼好后从 stdin 给 curl --upload-file -,不再用 -H。

实测:上行 289 bytes,subject / body 完整到达。
2026-07-15 13:32:42 +08:00
..

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 邮件正文(纯文本)

使用示例

- 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。