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