diff --git a/.gitea/ai-review/exclusions.json b/.gitea/ai-review/exclusions.json index 8d3f313..6dbc176 100644 --- a/.gitea/ai-review/exclusions.json +++ b/.gitea/ai-review/exclusions.json @@ -158,5 +158,15 @@ "role": "Aria", "location": "app/llm.js", "suggestion": "此 action 為 CLI 工具,process.exit(1) 是設計意圖讓 CI/CD workflow 失敗。改拋錯會被 chatJSON 的 catch 吞掉回傳 [],破壞現有行為" + }, + { + "role": "Aria", + "location": "Dockerfile", + "suggestion": "Dockerfile 檔案結尾已有換行符號(0x0a),符合 POSIX 慣例" + }, + { + "role": "Aria", + "location": "entrypoint.sh", + "suggestion": "entrypoint.sh 檔案結尾已有換行符號(0x0a),符合 POSIX 慣例" } ] diff --git a/action.yaml b/action.yaml index a1b6c68..7dce0bc 100644 --- a/action.yaml +++ b/action.yaml @@ -12,6 +12,10 @@ inputs: GITEA_REPOSITORY: description: 'Gitea Repository (owner/repo)' required: false + GITEA_SKIP_TLS_VERIFY: + description: '跳過 Gitea SSL/TLS 憑證驗證(自簽憑證時使用)' + required: false + default: 'false' PR_NUMBER: description: 'Pull Request Number' required: false @@ -80,6 +84,7 @@ runs: GITEA_TOKEN: ${{ inputs.GITEA_TOKEN || secrets.GITEA_TOKEN }} GITEA_SERVER_URL: ${{ inputs.GITEA_SERVER_URL || gitea.server_url }} GITEA_REPOSITORY: ${{ inputs.GITEA_REPOSITORY || gitea.repository }} + GITEA_SKIP_TLS_VERIFY: ${{ inputs.GITEA_SKIP_TLS_VERIFY }} PR_NUMBER: ${{ inputs.PR_NUMBER || gitea.event.pull_request.number }} PR_HEAD_BRANCH: ${{ inputs.PR_HEAD_BRANCH || gitea.event.pull_request.head.ref }} PR_BASE_BRANCH: ${{ inputs.PR_BASE_BRANCH || gitea.event.pull_request.base.ref }} diff --git a/app/config.js b/app/config.js index c8212e3..83921d5 100644 --- a/app/config.js +++ b/app/config.js @@ -1,6 +1,7 @@ export const GITEA_TOKEN = process.env.GITEA_TOKEN || ''; export const GITEA_SERVER_URL = process.env.GITEA_SERVER_URL || 'https://gitea.com'; export const GITEA_REPOSITORY = process.env.GITEA_REPOSITORY || ''; +export const GITEA_SKIP_TLS_VERIFY = process.env.GITEA_SKIP_TLS_VERIFY === 'true'; export const PR_NUMBER = process.env.PR_NUMBER || ''; export const PR_HEAD_BRANCH = process.env.PR_HEAD_BRANCH || ''; export const PR_BASE_BRANCH = process.env.PR_BASE_BRANCH || ''; diff --git a/app/gitea.js b/app/gitea.js index f8b4216..904b456 100644 --- a/app/gitea.js +++ b/app/gitea.js @@ -1,8 +1,8 @@ import axios from 'axios'; import https from 'https'; -import { GITEA_TOKEN, GITEA_SERVER_URL, GITEA_REPOSITORY, PR_NUMBER } from './config.js'; +import { GITEA_TOKEN, GITEA_SERVER_URL, GITEA_REPOSITORY, GITEA_SKIP_TLS_VERIFY, PR_NUMBER } from './config.js'; -const httpsAgent = new https.Agent({ rejectUnauthorized: false }); +const httpsAgent = GITEA_SKIP_TLS_VERIFY ? new https.Agent({ rejectUnauthorized: false }) : undefined; const headers = () => ({ Authorization: `token ${GITEA_TOKEN}`, 'Content-Type': 'application/json' }); const api = (path) => `${GITEA_SERVER_URL.replace(/\/$/, '')}/api/v1${path}`;