與GitHub Actions的對比
Gitea Actions 旨在與 GitHub Actions 相容,差異如下。
Action URL絕對路徑
Section titled “Action URL絕對路徑”uses: 接受指向任意 Git 主機的絕對 URL,例如 uses: https://gitea.com/actions/checkout@v4。
Action 前綴
Section titled “Action 前綴”uses: 接受以下前綴:
self:參照您自己的 Gitea 實例,例如uses: self:owner/repo@v1或uses: self:owner/repo/.gitea/workflows/build.yml@v1builtin:執行 Gitea Runner 內建的 Action,無需下載,Job 映像檔中也不需要 Node,例如uses: builtin:checkout
builtin:checkout 支援 actions/checkout 的 repository、ref、token、path 和 fetch-depth 輸入,預設值相同,其他輸入會使步驟失敗。
相對於工作流的 Actions
Section titled “相對於工作流的 Actions”$/ 參照工作流(或外層複合 Action)所在的儲存庫與提交,例如 uses: $/.gitea/actions/build。
與 ./ 不同,它不需要事先簽出程式碼。
使用Go編寫Actions
Section titled “使用Go編寫Actions”請參閱建立 Go Actions。
支援非標準的調度語法 @yearly, @monthly, @weekly, @daily, @hourly
Section titled “支援非標準的調度語法 @yearly, @monthly, @weekly, @daily, @hourly”schedule 也接受 @yearly、@monthly、@weekly、@daily 和 @hourly,GitHub 則不支援。
不支援的工作流語法
Section titled “不支援的工作流語法”jobs.<job_id>.environment
Section titled “jobs.<job_id>.environment”jobs.<job_id>.environment 會被忽略。
複雜的runs-on
Section titled “複雜的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' }}"]
套件儲存庫授權
Section titled “套件儲存庫授權”GITEA_TOKEN 無法發佈到其所屬儲存庫的套件註冊表,例如無法推送 OCI 鏡像。
請改用個人存取權杖,參見這個工單。
問題匹配器會被忽略。
為錯誤建立註釋
Section titled “為錯誤建立註釋”錯誤註釋會被忽略。
表達式支援 GitHub 的標準函式與上下文。
缺失的UI功能
Section titled “缺失的UI功能”預處理和後處理步驟
Section titled “預處理和後處理步驟”預處理和後處理步驟在 Job 日誌中沒有各自獨立的區塊。
服務步驟在 Job 日誌中沒有各自獨立的區塊。
不一樣的行為
Section titled “不一樣的行為”permissions和jobs.<job_id>.permissions
Section titled “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
Section titled “下載Actions”未指定主機的 Actions,例如 uses: actions/checkout@v4,會從 https://github.com 下載,若 [actions].DEFAULT_ACTIONS_URL 為 self,則從您自己的實例下載。
請參閱設定速查表。
其他來源請參閱 Action URL絕對路徑、Action 前綴和相對於工作流的 Actions。
上下文可用性
Section titled “上下文可用性”不檢查上下文可用性,因此 env 等上下文可以在更多地方使用。