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:
silverwind authored and bircni committed 2026-09-25 02:51:09 +00:00
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/)。
### 支持非标准的调度语法 @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`等上下文可以在更多地方使用。