Compare commits

...

16 Commits

Author SHA1 Message Date
jiantw83 624a71836c feat: update AI Code Review step to use OpenAI API key and base URL 2026-05-11 09:31:01 +00:00
jiantw83 fb1254aa32 feat: refactor AI Code Review step to use OLLAMA_BASE_URL and OLLAMA_MODEL
Co-authored-by: Copilot <copilot@github.com>
2026-05-11 09:10:20 +00:00
jiantw83 6eae6eb0ce feat: add OPENAI_MODEL parameter to AI Code Review step 2026-05-11 09:07:21 +00:00
jiantw83 ed1f2bea15 feat: update AI Code Review step to use DeepSeek API and correct API key
Co-authored-by: Copilot <copilot@github.com>
2026-05-11 09:03:03 +00:00
jiantw83 9a11d25c00 revert: 移除 DeepSeek-R1 特別處理 2026-05-11 08:58:59 +00:00
jiantw83 64b904dd07 fix: 支援不接受 system role 的模型(DeepSeek-R1) 2026-05-11 08:56:48 +00:00
jiantw83 73c11129ab feat: update AI Code Review step to use new OpenAI base URL and model 2026-05-11 08:55:53 +00:00
jiantw83 7ba2af3384 feat: update OPENAI_MODEL to use DeepSeek-R1-Distill-Qwen-32B for improved performance 2026-05-11 08:54:13 +00:00
jiantw83 aca76f23af feat: add OPENAI_MODEL parameter to AI Code Review step 2026-05-11 08:53:03 +00:00
jiantw83 bdf8d8a797 feat: update AI Code Review step to use OpenAI API key and base URL 2026-05-11 08:47:34 +00:00
jiantw83 e183e31ce0 fix: 忽略 SSL 憑證驗證(支援自簽憑證的 Ollama/Gitea) 2026-05-11 08:34:04 +00:00
jiantw83 7b5decf46a feat: update AI Code Review step to use vars instead of secrets for improved flexibility 2026-05-11 08:31:02 +00:00
jiantw83 0609e7fe7f feat: update OLLAMA configuration to use vars instead of secrets for improved flexibility 2026-05-11 08:29:59 +00:00
jiantw83 d20300eec7 feat: format AI Code Review step for improved readability 2026-05-11 08:27:51 +00:00
jiantw83 a9163cdfda feat: update AI Code Review action inputs to use OLLAMA configuration and set default OpenAI base URL 2026-05-11 08:24:47 +00:00
jiantw83 06303f784a feat: update workflow configurations for version calculation and API integration 2026-05-11 08:20:57 +00:00
6 changed files with 18 additions and 9 deletions
+4 -3
View File
@@ -1,10 +1,11 @@
name: CD
on:
push:
branches:
- master
jobs:
version:
name: "CD > 計算版本號"
name: 計算版本號
runs-on: ubuntu
outputs:
version: ${{ steps.version.outputs.version }}
@@ -13,14 +14,14 @@ jobs:
id: version
uses: https://gitea.jsc.idv.tw/actions/calculate-version@${{ vars.ACTION_CALCULATE_VERSION }}
release:
name: "CD > 發布專案"
name: 發布專案
runs-on: ubuntu
needs: version
steps:
- name: 發布專案
uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }}
with:
tag_name: "v${{ needs.version.outputs.version }}"
tag_name: v${{ needs.version.outputs.version }}
- name: 清理成品
uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }}
with:
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
tag_name: v${{ steps.version.outputs.version }}
target_commitish: ${{ github.head_ref }}
code-review:
name: Code Review
name: 'Code Review'
runs-on: ubuntu
needs: [version]
steps:
+4 -2
View File
@@ -41,6 +41,8 @@ jobs:
- name: AI Code Review
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }}
with:
# Github (h3285@evertrust.com.tw)
# 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
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: https://api.openai.com/v1
permissions:
@@ -262,8 +264,8 @@ jobs:
- name: AI Code Review
uses: https://gitea.jsc.idv.tw/jiantw83/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }}
with:
OLLAMA_BASE_URL: ${{ secrets.OLLAMA_BASE_URL }}
OLLAMA_MODEL: ${{ secrets.OLLAMA_MODEL }}
OLLAMA_BASE_URL: ${{ vars.OLLAMA_BASE_URL }}
OLLAMA_MODEL: ${{ vars.OLLAMA_MODEL }}
permissions:
contents: write
pull-requests: write
+1
View File
@@ -29,6 +29,7 @@ inputs:
OPENAI_BASE_URL:
description: 'OpenAI-compatible Base URL'
required: false
default: 'https://openrouter.ai/api/v1'
OPENAI_MODEL:
description: 'OpenAI-compatible Model Name'
required: false
+4 -2
View File
@@ -1,15 +1,17 @@
import axios from 'axios';
import https from 'https';
import { GITEA_TOKEN, GITEA_SERVER_URL, GITEA_REPOSITORY, PR_NUMBER } from './config.js';
const httpsAgent = new https.Agent({ rejectUnauthorized: false });
const headers = () => ({ Authorization: `token ${GITEA_TOKEN}`, 'Content-Type': 'application/json' });
const api = (path) => `${GITEA_SERVER_URL.replace(/\/$/, '')}/api/v1${path}`;
export async function getPRDiff() {
const resp = await axios.get(api(`/repos/${GITEA_REPOSITORY}/pulls/${PR_NUMBER}.diff`), { headers: headers(), timeout: 60000 });
const resp = await axios.get(api(`/repos/${GITEA_REPOSITORY}/pulls/${PR_NUMBER}.diff`), { headers: headers(), timeout: 60000, httpsAgent });
return resp.data;
}
export async function postComment(body) {
const resp = await axios.post(api(`/repos/${GITEA_REPOSITORY}/issues/${PR_NUMBER}/comments`), { body }, { headers: headers(), timeout: 30000 });
const resp = await axios.post(api(`/repos/${GITEA_REPOSITORY}/issues/${PR_NUMBER}/comments`), { body }, { headers: headers(), timeout: 30000, httpsAgent });
return resp.data;
}
+4 -1
View File
@@ -1,6 +1,9 @@
import axios from 'axios';
import https from 'https';
import { getLLMConfig } from './config.js';
const httpsAgent = new https.Agent({ rejectUnauthorized: false });
export async function chat(systemPrompt, userContent) {
const { provider, apiKey, baseURL, model } = getLLMConfig();
if (!provider) throw new Error('未設定任何 LLM API Key');
@@ -16,7 +19,7 @@ export async function chat(systemPrompt, userContent) {
const resp = await axios.post(
`${baseURL.replace(/\/$/, '')}/chat/completions`,
{ model, messages: [{ role: 'system', content: systemPrompt }, { role: 'user', content: userContent }], temperature: 0.2 },
{ headers, timeout: 120000 }
{ headers, timeout: 120000, httpsAgent }
);
return resp.data.choices[0].message.content;
}