Files
docs/i18n/zh-cn/docusaurus-plugin-content-docs/current/usage/actions/comparison.md
T
silverwind c4caf767ad 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]>
2026-09-25 02:51:09 +00:00

4.2 KiB

date, slug, sidebar_position
date slug sidebar_position
2023-05-24T15:00:00+08:00 comparison 15

与GitHub Actions的对比

Gitea Actions旨在与GitHub Actions兼容,差异如下。

额外功能

Action URL绝对路径

uses:支持指向任意Git托管平台的绝对URL,例如uses: https://gitea.com/actions/checkout@v4。

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输入,默认值相同,其他输入会使步骤失败。

相对于工作流的Actions

$/引用工作流所在的仓库和提交,或外层复合Action所在的仓库和提交,例如uses: $/.gitea/actions/build。 与./不同,它无需事先检出代码。

使用Go编写Actions

请参阅创建Go Actions。

支持非标准的调度语法 @yearly, @monthly, @weekly, @daily, @hourly

schedule还支持@yearly、@monthly、@weekly、@daily和@hourly,而GitHub不支持。

不支持的工作流语法

jobs.<job_id>.environment

jobs.<job_id>.environment会被忽略。

复杂的runs-on

runs-on支持:

  • 静态字符串: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镜像。 请改用个人访问令牌,参见此问题。

问题匹配器

问题匹配器会被忽略。

为错误创建注释

错误注释会被忽略。

表达式

表达式支持GitHub的标准函数和上下文。

缺失的UI功能

预处理和后处理步骤

预处理和后处理步骤在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令牌权限。

下载Actions

未指定主机的Actions(如uses: actions/checkout@v4)会从https://github.com下载,当[actions].DEFAULT_ACTIONS_URL为self时则从您自己的实例下载。 请参阅配置备忘单。 其他来源请参阅Action URL绝对路径、Action前缀和相对于工作流的Actions。

上下文可用性

不检查上下文可用性,因此env等上下文可以在更多地方使用。