mirror of
https://gitea.com/gitea/docs.git
synced 2026-11-09 03:20:34 +00:00
docs: document self:, builtin:, $/ and runner tracing (#553)
Documents the `self:` and `builtin:` action prefixes from https://github.com/go-gitea/gitea/pull/39358, https://gitea.com/gitea/runner/pulls/1233 and https://gitea.com/gitea/runner/pulls/871, workflow-relative `$/` actions, and the runner's OpenTelemetry tracing from https://gitea.com/gitea/runner/pulls/1206. 1. Trims the action resolution and `DEFAULT_ACTIONS_URL` docs to state each fact once. 1. Drops outdated runner content from the FAQ and design pages. 1. Syncs zh-cn and zh-tw, including a port of the token permissions page they now link to. _Written by Claude._ Reviewed-on: https://gitea.com/gitea/docs/pulls/553 Reviewed-by: bircni <[email protected]> Co-authored-by: silverwind <[email protected]>
This commit is contained in:
1 parent
f9124b16db
commit
c4caf767ad
19 files changed
+476
-444
No files matched your search
@@ -6,120 +6,97 @@ sidebar_position: 15
|
||||
|
||||
# 與GitHub Actions的對比
|
||||
|
||||
儘管Gitea Actions旨在與GitHub Actions相容,但它們之間存在一些差異。
|
||||
Gitea Actions 旨在與 GitHub Actions 相容,差異如下。
|
||||
|
||||
## 額外功能
|
||||
|
||||
<a id="absolute-action-urls"></a>
|
||||
### Action URL絕對路徑
|
||||
|
||||
Gitea Actions支援通過URL絕對路徑定義actions,這意味著您可以使用來自任何Git儲存庫的Actions。
|
||||
例如,`uses: https://github.com/actions/checkout@v4`或`uses: http://your_gitea.com/owner/repo@branch`。
|
||||
`uses:` 接受指向任意 Git 主機的絕對 URL,例如 `uses: https://gitea.com/actions/checkout@v4`。
|
||||
|
||||
<a id="action-prefixes"></a>
|
||||
### Action 前綴
|
||||
|
||||
`uses:` 接受以下前綴:
|
||||
|
||||
- `self:` 參照您自己的 Gitea 實例,例如 `uses: self:owner/repo@v1` 或 `uses: self:owner/repo/.gitea/workflows/build.yml@v1`
|
||||
- `builtin:` 執行 Gitea Runner 內建的 Action,無需下載,Job 映像檔中也不需要 Node,例如 `uses: builtin:checkout`
|
||||
|
||||
`builtin:checkout` 支援 `actions/checkout` 的 `repository`、`ref`、`token`、`path` 和 `fetch-depth` 輸入,預設值相同,其他輸入會使步驟失敗。
|
||||
|
||||
<a id="workflow-relative-actions"></a>
|
||||
### 相對於工作流的 Actions
|
||||
|
||||
`$/` 參照工作流(或外層複合 Action)所在的儲存庫與提交,例如 `uses: $/.gitea/actions/build`。
|
||||
與 `./` 不同,它不需要事先簽出程式碼。
|
||||
|
||||
### 使用Go編寫Actions
|
||||
|
||||
Gitea Actions支援使用Go編寫Actions。
|
||||
請參閱[建立Go Actions](https://blog.gitea.com/creating-go-actions/)。
|
||||
請參閱[建立 Go Actions](https://blog.gitea.com/creating-go-actions/)。
|
||||
|
||||
### 支援非標準的調度語法 @yearly, @monthly, @weekly, @daily, @hourly
|
||||
|
||||
Github Actions 不支援這些語法,詳見: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
|
||||
`schedule` 也接受 `@yearly`、`@monthly`、`@weekly`、`@daily` 和 `@hourly`,[GitHub 則不支援](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule)。
|
||||
|
||||
## 不支援的工作流語法
|
||||
|
||||
### `concurrency`
|
||||
|
||||
這是用於一次運行一個Job。
|
||||
請參閱[使用併發](https://docs.github.com/zh/actions/using-jobs/using-concurrency)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
|
||||
### `run-name`
|
||||
|
||||
這是工作流生成的工作流運行的名稱。
|
||||
請參閱[GitHub Actions 的工作流語法](https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#run-name)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
|
||||
### `permissions`和`jobs.<job_id>.permissions`
|
||||
|
||||
請參閱[GitHub Actions的工作流語法](https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#permissions)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
|
||||
### `jobs.<job_id>.timeout-minutes`
|
||||
|
||||
請參閱[GitHub Actions的工作流語法](https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
|
||||
### `jobs.<job_id>.continue-on-error`
|
||||
|
||||
請參閱[GitHub Actions的工作流語法](https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
|
||||
### `jobs.<job_id>.environment`
|
||||
|
||||
請參閱[GitHub Actions的工作流語法](https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment)。
|
||||
|
||||
Gitea Actions 目前不支援此功能。
|
||||
[`jobs.<job_id>.environment`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment) 會被忽略。
|
||||
|
||||
### 複雜的`runs-on`
|
||||
|
||||
請參閱[GitHub Actions的工作流語法](https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on)。
|
||||
[`runs-on`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on) 支援:
|
||||
|
||||
Gitea Actions目前只支援`runs-on: xyz`或`runs-on: [xyz]`。
|
||||
|
||||
### `hashFiles`表達式
|
||||
|
||||
請參閱[表達式](https://docs.github.com/en/actions/learn-github-actions/expressions#hashfiles)。
|
||||
|
||||
Gitea Actions目前不支援此功能,如果使用它,結果將始終為空字符串。
|
||||
|
||||
作為解決方法,您可以使用[go-hashfiles](https://gitea.com/actions/go-hashfiles)。
|
||||
- 靜態字串:`runs-on: self-hosted`
|
||||
- 標籤陣列:`runs-on: [linux, self-hosted]`
|
||||
- 字串表達式:`runs-on: ${{ github.event_name == 'push' && 'ubuntu-latest' || 'self-hosted' }}`
|
||||
- 包含表達式的陣列:`runs-on: [linux, "${{ github.event_name == 'push' && 'ubuntu-latest' || 'self-hosted' }}"]`
|
||||
|
||||
## 缺失的功能
|
||||
|
||||
### 套件儲存庫授權
|
||||
|
||||
`GITEA_TOKEN` 無法發佈到其所屬儲存庫的套件註冊表,例如無法推送 OCI 鏡像。
|
||||
請改用個人存取權杖,參見[這個工單](https://github.com/go-gitea/gitea/issues/23642#issuecomment-2119876692)。
|
||||
|
||||
### 問題匹配器
|
||||
|
||||
問題匹配器是一種掃描Actions輸出以查找指定正則表達式模式並在使用者介面中突出顯示該資訊的方法。
|
||||
請參閱[問題匹配器](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
[問題匹配器](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md)會被忽略。
|
||||
|
||||
### 為錯誤建立註釋
|
||||
|
||||
請參閱[為錯誤建立註釋](https://docs.github.com/zh/actions/using-workflows/workflow-commands-for-github-actions#example-creating-an-annotation-for-an-error)。
|
||||
|
||||
Gitea Actions目前不支援此功能。
|
||||
[錯誤註釋](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-creating-an-annotation-for-an-error)會被忽略。
|
||||
|
||||
### 表達式
|
||||
|
||||
對於 [表達式](https://docs.github.com/en/actions/learn-github-actions/expressions), 當前僅 [`always()`](https://docs.github.com/en/actions/learn-github-actions/expressions#always) 被支援。
|
||||
[表達式](https://docs.github.com/en/actions/learn-github-actions/expressions)支援 GitHub 的標準函式與上下文。
|
||||
|
||||
## 缺失的UI功能
|
||||
|
||||
### 預處理和後處理步驟
|
||||
|
||||
預處理和後處理步驟在Job日誌使用者介面中沒有自己的使用者介面。
|
||||
預處理和後處理步驟在 Job 日誌中沒有各自獨立的區塊。
|
||||
|
||||
### 服務步驟
|
||||
|
||||
服務步驟在Job日誌使用者介面中沒有自己的使用者介面。
|
||||
服務步驟在 Job 日誌中沒有各自獨立的區塊。
|
||||
|
||||
## 不一樣的行為
|
||||
|
||||
### `permissions`和`jobs.<job_id>.permissions`
|
||||
|
||||
`permissions` 和 `jobs.<job_id>.permissions` 控制 `GITEA_TOKEN` 的權限,其權限受儲存庫與所有者設定的限制,對於來自 fork 的拉取請求和跨儲存庫存取還會進一步受限。
|
||||
不支援 `statuses`、`checks`、`deployments`、`id-token`、`security-events` 和 `pages` 等 GitHub 專屬範圍,而 Gitea 另外提供 `code`、`releases`、`wiki` 和 `projects`。
|
||||
請參閱 [Actions Job 令牌權限](token-permissions.md)。
|
||||
|
||||
### 下載Actions
|
||||
|
||||
當 `[actions].DEFAULT_ACTIONS_URL` 保持預設值為 `github` 時,Gitea將會從 https://github.com 下載相對路徑的actions。比如:
|
||||
如果你使用 `uses: actions/checkout@v4`,Gitea將會從 https://github.com/actions/checkout.git 下載這個 actions 專案。
|
||||
如果你想要從另外一個 Git服務下載actions,你只需要使用絕對URL `uses: https://gitea.com/actions/checkout@v4` 來下載。
|
||||
|
||||
如果你的 Gitea 實例是部署在一個互聯網限制的網路中,也可以使用絕對地址來下載 actions。你也可以將設定項修改為 `[actions].DEFAULT_ACTIONS_URL = self`。這樣所有的相對路徑的actions引用,將不再會從 github.com 去下載,而會從這個 Gitea 實例自己的儲存庫中去下載。例如: `uses: actions/checkout@v4` 將會從 `[server].ROOT_URL`/actions/checkout.git 這個地址去下載 actions。
|
||||
|
||||
設定`[actions].DEFAULT_ACTIONS_URL`進行設定。請參閱[設定備忘單](../../administration/config-cheat-sheet.md#actions-actions)。
|
||||
未指定主機的 Actions,例如 `uses: actions/checkout@v4`,會從 `https://github.com` 下載,若 `[actions].DEFAULT_ACTIONS_URL` 為 `self`,則從您自己的實例下載。
|
||||
請參閱[設定速查表](../../administration/config-cheat-sheet.md#actions-actions)。
|
||||
其他來源請參閱 [Action URL絕對路徑](#absolute-action-urls)、[Action 前綴](#action-prefixes)和[相對於工作流的 Actions](#workflow-relative-actions)。
|
||||
|
||||
### 上下文可用性
|
||||
|
||||
不檢查上下文可用性,因此您可以在更多地方使用env上下文。
|
||||
請參閱[上下文可用性](https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability)。
|
||||
不檢查[上下文可用性](https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability),因此 `env` 等上下文可以在更多地方使用。
|
||||
Reference in new issue
Block a user