Files
sync-branch/README.md
T
2026-11-05 03:57:45 +00:00

33 lines
1.3 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.
# sync-branch
目標分支不存在或已包含該提交就什麼都不做;有衝突就失敗。
## 用法
版本由呼叫端的 Gitea Actions 變數決定(例如 `vars.ACTION_SYNC_BRANCH_VERSION`),不要用分支名稱:runner 依 ref 重用舊映像檔,改了腳本不會生效,所以每次改動都發新標籤。
```yaml
- uses: https://gitea.jsc.idv.tw/actions/sync-branch@${{ vars.ACTION_SYNC_BRANCH_VERSION }}
with:
source: ...
target: ...
```
## 輸入
|名稱|必填|預設|說明|
|---|---|---|---|
|`source`|是||來源分支名稱(例如 main)|
|`target`|是||目標分支名稱(例如 dev)|
|`sha`||`${{ github.sha }}`|要合併進去的來源提交,預設是目前的 github.sha|
## 開發
`ci.yaml` 用共用的 [action-ci](https://gitea.jsc.idv.tw/actions/action-ci) 跑 shellcheck、Go 黑箱測試、映像檔建置。
圖示:`icon.svg`(Gitea 儲存庫頭像用 `icon.png`)。
## 發版
只在「任何分支 → `main`」的 PR 合併時,`cd.yaml` 用 [release-go](https://gitea.jsc.idv.tw/actions/release-go) 算下一個版本,在 PR 來源分支的最新提交上打標籤(只遞增 patch,每位最大 9);只動文件、圖示、測試、`.gitea/`、`go.mod` 時不發版。直接推送 `main` 不發版。呼叫端要把 Gitea 變數 `ACTION_SYNC_BRANCH_VERSION` 改成新標籤才會採用。