58 lines
2.3 KiB
YAML
58 lines
2.3 KiB
YAML
# ============================================================
|
||
# 用途:Gitea CI,在 pull request 上執行 AI 程式碼審查(AI code review on pull requests)
|
||
# 更新日期:2026/06/26 11:34:46
|
||
# ============================================================
|
||
|
||
# workflow 名稱,會顯示在 Gitea Actions 介面上
|
||
name: CI
|
||
# 觸發條件設定
|
||
on:
|
||
# 針對 pull request 事件觸發
|
||
pull_request:
|
||
# 忽略指定目標分支:當 PR 目標分支為 master 時不觸發此 workflow
|
||
branches-ignore:
|
||
- master
|
||
# 觸發的 PR 事件類型:opened(PR 開啟)、synchronize(PR 有新 commit 推送)
|
||
types: [opened, synchronize]
|
||
# 定義此 workflow 的 jobs
|
||
jobs:
|
||
release-tag-version:
|
||
name: Release Tag Version
|
||
runs-on: ubuntu
|
||
outputs:
|
||
version: ${{ steps.release-tag-version.outputs.version }}
|
||
steps:
|
||
- name: 計算版本號
|
||
id: release-tag-version
|
||
uses: https://gitea.jsc.idv.tw/composite-actions/release-tag-version@${{ vars.ACTION_RELEASE_TAG_VERSION }}
|
||
with:
|
||
is_beta: true
|
||
# job 識別碼:ai-code-review
|
||
ai-code-review:
|
||
# job 顯示名稱
|
||
name: AI Code Review
|
||
needs: release-tag-version
|
||
# 指定執行環境的 runner 標籤:ubuntu
|
||
runs-on: ubuntu
|
||
# job 的執行步驟
|
||
steps:
|
||
- name: 取得程式碼
|
||
uses: actions/checkout@${{ vars.ACTION_CHECKOUT_VERSION }}
|
||
- name: AI 程式碼審查
|
||
# 使用外部 composite action 執行審查邏輯。
|
||
# 版本由 release-tag-version 計算,便於在 PR 中測試目前 action 版本。
|
||
uses: https://gitea.jsc.idv.tw/docker-actions/ai-code-review@v${{ needs.release-tag-version.outputs.version }}
|
||
# 此 job 所需的權限設定
|
||
permissions:
|
||
# 對 repository 內容的寫入權限(讀寫程式碼/檔案)
|
||
contents: write
|
||
# 對 pull request 的寫入權限(讓 AI 可在 PR 上留言/審查)
|
||
pull-requests: write
|
||
# 對 issues 的寫入權限(建立/更新 issue 留言所需)
|
||
issues: write
|
||
# 傳遞給 composite action 的輸入參數
|
||
with:
|
||
# 留言用 token:取自 secret COMMENT_TOKEN,供 action 在 PR 上發布審查留言
|
||
token: ${{ secrets.TOKEN }}
|
||
model: ${{ vars.AI_CODE_REVIEW_MODEL }}
|