11 Commits

Author SHA1 Message Date
Aliapoh f2cb193415 Merge pull request 'revert 643e2f6b7fe702c05bd757b4fdfc5e1c6939b168' (#11) from remove-test into main
Reviewed-on: #11
2026-07-18 14:48:52 +08:00
Aliapoh c475662e9f revert 643e2f6b7f
AI Pull Request Review / Review changed code (pull_request) Successful in 5m40s
revert Merge pull request '添加 1.txt' (#9) from ai-review-test into main

Reviewed-on: #9
2026-07-18 14:39:18 +08:00
Aliapoh 18c478ecf7 更新 .gitea/workflows/ai-review.yml 2026-07-18 14:38:19 +08:00
Aliapoh 643e2f6b7f Merge pull request '添加 1.txt' (#9) from ai-review-test into main
Reviewed-on: #9
2026-07-18 13:59:19 +08:00
Aliapoh c63220f924 添加 1.txt
AI Pull Request Review / Review changed code (pull_request) Failing after 2m53s
2026-07-18 13:59:12 +08:00
Aliapoh 556b0cc383 revert dcd1b25175
revert Merge pull request 'Add Gitea Actions smoke test' (#8) from chore/gitea-actions-smoke into main

Reviewed-on: #8
2026-07-18 13:56:19 +08:00
Aliapoh 99eb9b9e6f 更新 .gitea/workflows/ai-review.yml
Actions Smoke Test / test (push) Successful in 0s
2026-07-18 13:55:08 +08:00
Aliapoh 00061934f6 更新 .gitea/scripts/ai-review.mjs
Actions Smoke Test / test (push) Successful in 0s
2026-07-18 13:54:38 +08:00
chenjiahao dcd1b25175 Merge pull request 'Add Gitea Actions smoke test' (#8) from chore/gitea-actions-smoke into main
Actions Smoke Test / test (push) Successful in 1s
Reviewed-on: #8
2026-07-18 13:44:27 +08:00
Aliapoh d773727bb6 Add Gitea Actions smoke test
AI Pull Request Review / Review changed code (pull_request) Failing after 2m44s
Actions Smoke Test / test (pull_request) Successful in 1s
2026-07-18 13:32:56 +08:00
Aliapoh 4f77c36ad1 Merge pull request 'Ai review' (#5) from ai-review into main
Reviewed-on: #5
2026-07-18 11:59:23 +08:00
2 changed files with 17 additions and 2 deletions
+15 -1
View File
@@ -43,6 +43,20 @@ function extractOutputText(response) {
return parts.join("\n").trim();
}
function resolveGiteaApiUrl(event) {
if (process.env.GITEA_API_URL) return process.env.GITEA_API_URL;
const repositoryApiUrl = event.repository?.url;
const reposMarker = "/repos/";
const markerIndex = repositoryApiUrl?.indexOf(reposMarker) ?? -1;
if (markerIndex > 0) return repositoryApiUrl.slice(0, markerIndex);
const serverUrl = process.env.GITEA_SERVER_URL;
if (serverUrl) return `${serverUrl.replace(/\/$/, "")}/api/v1`;
throw new Error("Cannot determine the Gitea API URL from the environment or event payload");
}
async function upsertComment({ apiUrl, token, owner, repo, number, body }) {
const headers = {
Accept: "application/json",
@@ -98,7 +112,7 @@ async function main() {
const diff = runGit(["diff", "--no-ext-diff", "--unified=30", `${baseSha}...${headSha}`]);
const number = pull.number || event.number;
const commentContext = {
apiUrl: required("GITEA_API_URL"),
apiUrl: resolveGiteaApiUrl(event),
token: required("GITEA_TOKEN"),
owner,
repo,
+2 -1
View File
@@ -12,7 +12,7 @@ jobs:
if: ${{ gitea.event.pull_request.head.repo.full_name == gitea.repository }}
steps:
- name: Check out the trusted reviewer from the target revision
uses: actions/checkout@v4
uses: https://gitea.com/actions/checkout@v4
with:
ref: ${{ gitea.event.pull_request.base.sha }}
fetch-depth: 0
@@ -21,6 +21,7 @@ jobs:
- name: Run AI review
working-directory: trusted
env:
GITEA_API_URL: ${{ gitea.api_url }}
GITEA_TOKEN: ${{ secrets.AI_REVIEW_GITEA_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_MODEL: ${{ secrets.OPENAI_MODEL }}