4 Commits
Author SHA1 Message Date
beforegolive e9ed21bd4d feat(notify-all): 加 channels input 选择通知通道 (v1.2.0)
lint / yamllint (push) Successful in 6m52s
新 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
beforegolive 323bf9bfdb docs: README 加 submodule 引用说明(独立发布模式)
lint / yamllint (push) Successful in 15s
撤销之前的「已迁移到 docker-gitea/ci-actions」banner——本仓库是被
docker-gitea 通过 git submodule 引用,**不是被合并**。业务仓库 workflow
'uses:' URL 仍指向本仓库(不变)。所有 action 改动 + tag 都在本仓库进行。
2026-07-16 09:34:56 +08:00
beforegolive 507124d91c docs: 仓库已迁移到 docker-gitea/ci-actions 子目录(archive)
lint / yamllint (push) Successful in 18s
2026-07-16 git subtree merge 后,本仓库作为独立仓库不再接收更新。
业务 repo 'uses:' 路径改为 http://gitea:3000/gitea_admin/docker-gitea/ci-actions/<name>@<tag>。
新位置:http://pipeline.beforegolive.com:9977/gitea_admin/docker-gitea/src/branch/main/ci-actions/
2026-07-16 09:27:39 +08:00
beforegolive 224f5bdd78 feat(notify-all): sha 字段截短到前 10 位(git short SHA)
lint / yamllint (push) Successful in 13s
2026-07-16 09:00:38 +08:00
3 changed files with 72 additions and 23 deletions
+6
View File
@@ -2,6 +2,12 @@
Gitea Actions 公共 action 仓库。 Gitea Actions 公共 action 仓库。
> **维护模式**2026-07-16 起):本仓库**独立发布**(自己打 tag`v1.x.y`)。
> `gitea_admin/docker-gitea` 仓库通过 **git submodule** 把本仓库作为 `ci-actions/`
> 子目录引入,方便在 docker-gitea 仓库内查看/同步代码;
> 但所有 action 改动与发版都**在本仓库**进行(commit + push + tag),业务仓库
> workflow 的 `uses:` URL 仍指向本仓库 `http://gitea:3000/gitea_admin/ci-actions/<name>@<tag>`。
通过 `uses: gitea_admin/ci-actions/<name>@v1` 在业务 workflow 中复用, 通过 `uses: gitea_admin/ci-actions/<name>@v1` 在业务 workflow 中复用,
避免每个仓库重复实现。 避免每个仓库重复实现。
+25 -1
View File
@@ -36,8 +36,8 @@ secret 走 org-levelgitea_admin org 已配)。
| Input | Default | 说明 | | Input | Default | 说明 |
|---|---|---| |---|---|---|
| `channels` | `both` | 通知通道:`both` / `bark` / `email` |
| `title` | `[${{ github.repository }}] ${{ github.workflow }}` | Bark 推送标题 | | `title` | `[${{ github.repository }}] ${{ github.workflow }}` | Bark 推送标题 |
| `body` | 自动拼 status / branch / commit / sha / actor / run | 通知正文(Bark + Email 共用) |
| `email_subject` | `[gitea-ci] ${{ github.repository }} - ${{ inputs.status }}` | 邮件主题 | | `email_subject` | `[gitea-ci] ${{ github.repository }} - ${{ inputs.status }}` | 邮件主题 |
| `bark_device_key` | `${{ secrets.BARK_DEVICE_KEY }}` | Bark keyorg secret | | `bark_device_key` | `${{ secrets.BARK_DEVICE_KEY }}` | Bark keyorg secret |
| `bark_server` | `https://api.day.app` | Bark server(自建时改) | | `bark_server` | `https://api.day.app` | Bark server(自建时改) |
@@ -49,6 +49,19 @@ secret 走 org-levelgitea_admin org 已配)。
| `smtp_pass` | `${{ secrets.EMAIL_SMTP_PASS }}` | SMTP 授权码(org secret | | `smtp_pass` | `${{ secrets.EMAIL_SMTP_PASS }}` | SMTP 授权码(org secret |
| `to` | `${{ secrets.EMAIL_TO }}` | 收件邮箱(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 已配) ## 依赖的 org-level secretgitea_admin org 已配)
- `BARK_DEVICE_KEY` - `BARK_DEVICE_KEY`
@@ -58,6 +71,17 @@ secret 走 org-levelgitea_admin org 已配)。
业务 repo 不需要再配 secret。 业务 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 `notify-all` 是 composite action,内部 chain 调 sibling action
+41 -22
View File
@@ -2,31 +2,24 @@ name: 'Notify All'
description: 'Bark push + email in one step. Zero-config when paired with org/instance-level secrets.' description: 'Bark push + email in one step. Zero-config when paired with org/instance-level secrets.'
author: 'gitea_admin' author: 'gitea_admin'
# 设计要点2026-07-15): # v1.1.2 改动2026-07-15):
# - title / body / subject 等全用 github.* + inputs.status 自动拼,业务 repo 只需传 status # - sha 字段截短到前 10 位(git short SHA 标准)
# - secret 默认走 org-levelgitea_admin org 已配 BARK_DEVICE_KEY / EMAIL_USER / # - 因为 input default 在 composite 开始时 evaluate,引用不到 steps.output
# EMAIL_SMTP_PASS / EMAIL_TO 4 个 secret),业务 repo 0 secret 配置 # 所以把 body 从 input default 移到 step with 里(直接用 ${{ steps.short_sha.outputs.value }}
# - Bark + Email 两个 step 在内部 chain 调 sibling action./notify-bark / ./notify-email), # - 删 body input —— 业务侧不能 override body;如要自定义可走 notify-bark/notify-email 直引
# 避免业务 repo 写两个 step
inputs: inputs:
status: status:
description: 'Build job status (caller passes ${{ needs.<job>.result }})' description: 'Build job status (caller passes ${{ needs.<job>.result }})'
required: true required: true
channels:
description: 'Notification channels: both (default) / bark / email'
required: false
default: 'both'
title: title:
description: 'Notification title' description: 'Notification title'
required: false required: false
default: "[${{ github.repository }}] ${{ github.workflow }}" default: "[${{ github.repository }}] ${{ github.workflow }}"
body:
description: 'Notification body (auto-built if not provided)'
required: false
default: |
status: ${{ inputs.status }}
branch: ${{ github.ref_name }}
commit: ${{ github.event.head_commit.message }}
sha: ${{ github.event.head_commit.id }}
actor: ${{ github.actor }}
run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
email_subject: email_subject:
description: 'Email subject' description: 'Email subject'
required: false required: false
@@ -75,20 +68,38 @@ inputs:
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
# 链式调用 sibling action。act_runner 0.2.11 不支持 ./relative path # 1. 算 short SHAgit 标准 10 位)。Gitea 表达式没 slice/substring 函数,必须用 shell
# 必须用完整 URL。tag 跟 notify-all 自己同一个 tag,确保三个 action 自包含。 - name: Compute short SHA
id: short_sha
shell: bash
run: |
SHA="${{ github.event.head_commit.id }}"
SHORT="${SHA:0:10}"
echo "value=${SHORT}" >> "$GITHUB_OUTPUT"
# 2. Push to Bark(链式调 sibling action,完整 URL 因为 act_runner 0.2.11 不支持 ./relative
# 默认走 bark + email (channels=both),可传 channels=bark 只推 bark / channels=email 只发邮件
- name: Push to Bark - name: Push to Bark
uses: http://gitea:3000/gitea_admin/ci-actions/notify-bark@v1.1.1 if: ${{ inputs.channels != 'email' }}
uses: http://gitea:3000/gitea_admin/ci-actions/notify-bark@v1.1.2
with: with:
device_key: ${{ inputs.bark_device_key }} device_key: ${{ inputs.bark_device_key }}
server: ${{ inputs.bark_server }} server: ${{ inputs.bark_server }}
title: ${{ inputs.title }} title: ${{ inputs.title }}
body: ${{ inputs.body }} body: |
status: ${{ inputs.status }}
branch: ${{ github.ref_name }}
commit: ${{ github.event.head_commit.message }}
sha: ${{ steps.short_sha.outputs.value }}
actor: ${{ github.actor }}
run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
group: ${{ inputs.bark_group }} group: ${{ inputs.bark_group }}
level: ${{ inputs.bark_level }} level: ${{ inputs.bark_level }}
# 3. Send email
- name: Send email - name: Send email
uses: http://gitea:3000/gitea_admin/ci-actions/notify-email@v1.1.1 if: ${{ inputs.channels != 'bark' }}
uses: http://gitea:3000/gitea_admin/ci-actions/notify-email@v1.1.2
with: with:
smtp_host: ${{ inputs.smtp_host }} smtp_host: ${{ inputs.smtp_host }}
smtp_port: ${{ inputs.smtp_port }} smtp_port: ${{ inputs.smtp_port }}
@@ -96,4 +107,12 @@ runs:
smtp_pass: ${{ inputs.smtp_pass }} smtp_pass: ${{ inputs.smtp_pass }}
to: ${{ inputs.to }} to: ${{ inputs.to }}
subject: ${{ inputs.email_subject }} subject: ${{ inputs.email_subject }}
body: ${{ inputs.body }} body: |
repository: ${{ github.repository }}
workflow: ${{ github.workflow }}
status: ${{ inputs.status }}
branch: ${{ github.ref_name }}
commit: ${{ github.event.head_commit.message }}
sha: ${{ steps.short_sha.outputs.value }}
url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
actor: ${{ github.actor }}