`$/` is [GitHub's self-repository prefix](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-using-an-action-in-the-same-repository-as-the-workflow-at-the-running-commit-recommended) with the same semantics, so it is no Gitea addition. The `builtin:checkout` input list was outdated since https://gitea.com/gitea/runner/pulls/1277 made it match `actions/checkout`. Reviewed-on: https://gitea.com/gitea/docs/pulls/638 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: silverwind <[email protected]>
3.8 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@v1builtin:运行Gitea Runner内置的Action,无需下载,也不依赖Node.js,例如uses: builtin:checkout
使用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、security-events和pages等GitHub专有的权限范围,而Gitea额外提供了code、releases、wiki和projects。id-token与GitHub相同,请参阅OpenID Connect。
请参阅Actions Job令牌权限。
下载Actions
未指定主机的Actions(如uses: actions/checkout@v4)会从https://github.com下载,当[actions].DEFAULT_ACTIONS_URL为self时则从您自己的实例下载。
请参阅配置备忘单。
其他来源请参阅Action URL绝对路径和Action前缀。
上下文可用性
不检查上下文可用性,因此env等上下文可以在更多地方使用。