feat(CI 工作流程): 僅在 beta 啟用 AI 審查 #7
+39
-34
@@ -1,9 +1,14 @@
|
||||
# --------------------------------------------------
|
||||
# 用途:定義 CI 工作流程,處理 pull request 的版本發佈與測試。
|
||||
# 更新日期:2026/07/11 17:44:33(Asia/Taipei)
|
||||
# --------------------------------------------------
|
||||
|
||||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- master
|
||||
- develop
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
build:
|
||||
@@ -16,13 +21,13 @@ jobs:
|
||||
version: ${{ env.VERSION }}
|
||||
is_beta: ${{ env.IS_BETA }}
|
||||
steps:
|
||||
- name: Publishing Release
|
||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }}
|
||||
with:
|
||||
name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}"
|
||||
tag_name: "v${{ env.VERSION }}"
|
||||
target_commitish: ${{ gitea.sha }}
|
||||
prerelease: ${{ env.IS_BETA }}
|
||||
- name: Publishing Release
|
||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }}
|
||||
with:
|
||||
name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}"
|
||||
tag_name: "v${{ env.VERSION }}"
|
||||
target_commitish: ${{ gitea.sha }}
|
||||
prerelease: ${{ env.IS_BETA }}
|
||||
test:
|
||||
name: 2. TEST
|
||||
runs-on: ubuntu
|
||||
@@ -33,36 +38,36 @@ jobs:
|
||||
outputs:
|
||||
version: ${{ steps.calculate-version.outputs.version }}
|
||||
steps:
|
||||
- name: Run Calculate Version
|
||||
id: calculate-version
|
||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@v${{ env.VERSION }}
|
||||
with:
|
||||
is_beta: ${{ env.IS_BETA == "true" }}
|
||||
- name: Setup LLM CLI
|
||||
uses: https://gitea.jsc.idv.tw/actions/setup-${{ vars.ACTION_SETUP_LLM_CLI }}
|
||||
if: ${{ env.IS_BETA == 'true' }}
|
||||
with:
|
||||
oauth: ${{ secrets.LLM_OAUTH }}
|
||||
- name: Run AI Code Review
|
||||
uses: https://gitea.jsc.idv.tw/actions/ai-code-review@${{ vars.ACTION_AI_CODE_REVIEW_VERSION }}
|
||||
id: ai-code-review
|
||||
if: ${{ env.IS_BETA == 'true' }}
|
||||
with:
|
||||
token: ${{ secrets.TOKEN }}
|
||||
model: ${{ vars.LLM_NAME }}
|
||||
- name: Run Calculate Version
|
||||
id: calculate-version
|
||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@v${{ env.VERSION }}
|
||||
with:
|
||||
is_beta: ${{ env.IS_BETA == "true" }}
|
||||
- name: Setup LLM CLI
|
||||
uses: https://gitea.jsc.idv.tw/actions/setup-${{ vars.ACTION_SETUP_LLM_CLI }}
|
||||
if: ${{ env.IS_BETA == 'true' }}
|
||||
with:
|
||||
oauth: ${{ secrets.LLM_OAUTH }}
|
||||
- name: Run AI Code Review
|
||||
uses: https://gitea.jsc.idv.tw/actions/ai-code-review@${{ vars.ACTION_AI_CODE_REVIEW_VERSION }}
|
||||
id: ai-code-review
|
||||
if: ${{ env.IS_BETA == 'true' }}
|
||||
with:
|
||||
token: ${{ secrets.TOKEN }}
|
||||
model: ${{ vars.LLM_NAME }}
|
||||
result:
|
||||
name: 3. RESULT
|
||||
runs-on: ubuntu
|
||||
needs: [build,test]
|
||||
needs: [build, test]
|
||||
if: ${{ needs.build.outputs.is_beta == 'false' }}
|
||||
env:
|
||||
VERSION: ${{ needs.test.outputs.version }}
|
||||
IS_BETA: ${{ needs.build.outputs.is_beta }}
|
||||
steps:
|
||||
- name: Publishing Release
|
||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }}
|
||||
with:
|
||||
name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}"
|
||||
tag_name: "v${{ env.VERSION }}"
|
||||
target_commitish: ${{ gitea.sha }}
|
||||
prerelease: ${{ env.IS_BETA == "true" }}
|
||||
- name: Publishing Release
|
||||
uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }}
|
||||
with:
|
||||
name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}"
|
||||
tag_name: "v${{ env.VERSION }}"
|
||||
target_commitish: ${{ gitea.sha }}
|
||||
prerelease: ${{ env.IS_BETA == "true" }}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
# --------------------------------------------------
|
||||
# 用途:定義 calculate-version action 的 Docker 執行環境。
|
||||
# 更新日期:2026/07/11 17:44:33(Asia/Taipei)
|
||||
# --------------------------------------------------
|
||||
|
||||
FROM node:lts-alpine
|
||||
|
||||
WORKDIR /action
|
||||
|
||||
+14
-9
@@ -1,19 +1,24 @@
|
||||
name: 'Calculate Version'
|
||||
description: '計算版本號'
|
||||
author: 'Jeffery'
|
||||
# --------------------------------------------------
|
||||
# 用途:宣告 Calculate Version action 的輸入、輸出與 Docker 執行方式。
|
||||
# 更新日期:2026/07/11 17:44:33(Asia/Taipei)
|
||||
# --------------------------------------------------
|
||||
|
||||
name: "Calculate Version"
|
||||
description: "計算版本號"
|
||||
author: "Jeffery"
|
||||
inputs:
|
||||
is_beta:
|
||||
description: '是否為 beta 版本'
|
||||
default: 'false'
|
||||
description: "是否為 beta 版本"
|
||||
default: "false"
|
||||
runner_token:
|
||||
description: '用於讀取 release 的 token'
|
||||
description: "用於讀取 release 的 token"
|
||||
required: false
|
||||
outputs:
|
||||
version:
|
||||
description: '計算出的版本號'
|
||||
description: "計算出的版本號"
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
using: "docker"
|
||||
image: "Dockerfile"
|
||||
env:
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#!/bin/sh
|
||||
# --------------------------------------------------
|
||||
# 用途:啟動 calculate-version action,將所有參數交給 Node 主程式。
|
||||
# 更新日期:2026/07/11 17:44:33(Asia/Taipei)
|
||||
# --------------------------------------------------
|
||||
|
||||
set -eu
|
||||
|
||||
exec node /action/src/index.js "$@"
|
||||
|
||||
Reference in New Issue
Block a user