Files
ci-actions/notify-all/README.md
T
beforegolive e9ed21bd4d
lint / yamllint (push) Successful in 6m52s
feat(notify-all): 加 channels input 选择通知通道 (v1.2.0)
新 input:
  channels: 默认 'both'(同时推 Bark + 发邮件)
           可选 'bark'(只推 Bark)/ 'email'(只发邮件)

实现:composite step 加 'if' 条件
  Push to Bark:  if ${{ inputs.channels != 'email' }}
  Send email:    if ${{ inputs.channels != 'bark' }}

兼容:未传 channels 时默认 both,向后兼容 v1.1.x 用法。

README.md / docker-gitea/docs/ci-actions.md 同步更新。
2026-07-16 13:48:01 +08:00

96 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# notify-all
Bark iOS push + SMTP email in **one step**. Designed for zero-config when paired with
**org-level** (or instance-level) secrets on Gitea.
## Usage (极简 / recommended)
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "your build steps"
notify:
needs: build
if: always()
runs-on: ubuntu-latest
steps:
- name: notify
uses: http://gitea:3000/gitea_admin/ci-actions/notify-all@v1
with:
status: ${{ needs.build.result }}
```
That's it — Bark 推送 + 邮件发送全自动,body/title/subject 自动从 `github.*` + `inputs.status` 拼,
secret 走 org-levelgitea_admin org 已配)。
## 必传
| Input | 来源 | 说明 |
|---|---|---|
| `status` | caller → `${{ needs.build.result }}` | 唯一必传,用于拼 body / subject |
## 可选 inputs(全部有默认值)
| Input | Default | 说明 |
|---|---|---|
| `channels` | `both` | 通知通道:`both` / `bark` / `email` |
| `title` | `[${{ github.repository }}] ${{ github.workflow }}` | Bark 推送标题 |
| `email_subject` | `[gitea-ci] ${{ github.repository }} - ${{ inputs.status }}` | 邮件主题 |
| `bark_device_key` | `${{ secrets.BARK_DEVICE_KEY }}` | Bark keyorg secret |
| `bark_server` | `https://api.day.app` | Bark server(自建时改) |
| `bark_group` | `gitea-ci` | Bark 分组 |
| `bark_level` | `active` | active / timeSensitive / passive / default |
| `smtp_host` | `smtp.163.com` | SMTP host |
| `smtp_port` | `465` | SMTP SSL 端口 |
| `smtp_user` | `${{ secrets.EMAIL_USER }}` | 发件邮箱(org secret |
| `smtp_pass` | `${{ secrets.EMAIL_SMTP_PASS }}` | SMTP 授权码(org secret |
| `to` | `${{ secrets.EMAIL_TO }}` | 收件邮箱(org secret |
> body 不再是 inputv1.1.2 起),由 notify-all 自动拼(status / branch / commit / **sha 前 10 位** / actor / run)。如需自定义 body,绕开 notify-all 直接用 notify-bark + notify-email。
## 自动拼的 body 格式
```
status: success
branch: main
commit: ci: any commit message
sha: 29a4454e0 # ← 只取前 10 位
actor: gitea_admin
run: http://gitea:3000/gitea_admin/<repo>/actions/runs/<id>
```
## 依赖的 org-level secretgitea_admin org 已配)
- `BARK_DEVICE_KEY`
- `EMAIL_USER`
- `EMAIL_SMTP_PASS`
- `EMAIL_TO`
业务 repo 不需要再配 secret。
## 选通道
```yaml
- uses: http://gitea:3000/gitea_admin/ci-actions/notify-all@v1.2.0
with:
status: ${{ needs.build.result }}
channels: email # 只发邮件(不推 Bark
```
可选值:`both`(默认)/ `bark` / `email`
## 内部实现
`notify-all` 是 composite action,内部 chain 调 sibling action
- `uses: ./notify-bark`
- `uses: ./notify-email`
v1.1.0 tag 下三个 action 自包含,runner 拉一次仓库就够。
## 失败处理
Bark / Email 任一失败 → `::warning::` 输出 → step 仍 Success → job 不阻塞。
(继承自 `notify-bark` / `notify-email``curl --retry 2` + `if !` 包裹逻辑。)