Merge pull request 'fix: add bash to Dockerfile dependencies' (#64) from feat/refactor/kiro/1 into feat/refactor/main

Reviewed-on: jiantw83/code-review#64
This commit is contained in:
2026-05-11 10:54:08 +00:00
2 changed files with 35 additions and 18 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
FROM alpine
RUN apk add --no-cache nodejs npm git \
RUN apk add --no-cache bash nodejs npm git \
&& node --version \
&& npm --version \
&& git --version
+34 -17
View File
@@ -15,24 +15,41 @@ export async function commitAndPush(workspace) {
.replace('https://', `https://${GITEA_TOKEN}@`)
.replace('http://', `http://${GITEA_TOKEN}@`) + `/${GITEA_REPOSITORY}.git`;
try {
git(['config', 'user.email', 'ai-review[bot]@gitea'], repoDir);
git(['config', 'user.name', 'AI Review Bot'], repoDir);
git(['fetch', 'origin', PR_HEAD_BRANCH], repoDir);
git(['checkout', PR_HEAD_BRANCH], repoDir);
git(['add', FINDINGS_PATH], repoDir);
// try {
// git(['config', 'user.email', 'ai-review[bot]@gitea'], repoDir);
// git(['config', 'user.name', 'AI Review Bot'], repoDir);
// git(['fetch', 'origin', PR_HEAD_BRANCH], repoDir);
// git(['checkout', PR_HEAD_BRANCH], repoDir);
// git(['add', FINDINGS_PATH], repoDir);
const status = git(['status', '--porcelain'], repoDir);
if (!status) {
console.log(' findings.json 無變更,跳過 commit');
return;
}
// const status = git(['status', '--porcelain'], repoDir);
// if (!status) {
// console.log(' findings.json 無變更,跳過 commit');
// return;
// }
const out = git(['commit', '-m', 'chore: update ai-review findings [skip ci]'], repoDir);
const commitHash = out.match(/\[.+ ([a-f0-9]+)\]/)?.[1] || 'unknown';
git(['push', remoteUrl, PR_HEAD_BRANCH], repoDir);
console.log(` ✅ persisted findings commit=${commitHash} push=${PR_HEAD_BRANCH}`);
} catch (e) {
console.log(` ⚠️ Runner failed: commit/push 失敗: ${e.message}`);
// const out = git(['commit', '-m', 'chore: update ai-review findings [skip ci]'], repoDir);
// const commitHash = out.match(/\[.+ ([a-f0-9]+)\]/)?.[1] || 'unknown';
// git(['push', remoteUrl, PR_HEAD_BRANCH], repoDir);
// console.log(` ✅ persisted findings commit=${commitHash} push=${PR_HEAD_BRANCH}`);
// } catch (e) {
// console.log(` ⚠️ Runner failed: commit/push 失敗: ${e.message}`);
// }
git(['config', 'user.email', 'ai-review[bot]@gitea'], repoDir);
git(['config', 'user.name', 'AI Review Bot'], repoDir);
git(['fetch', 'origin', PR_HEAD_BRANCH], repoDir);
git(['checkout', PR_HEAD_BRANCH], repoDir);
git(['add', FINDINGS_PATH], repoDir);
const status = git(['status', '--porcelain'], repoDir);
if (!status) {
console.log(' findings.json 無變更,跳過 commit');
return;
}
const out = git(['commit', '-m', 'chore: update ai-review findings [skip ci]'], repoDir);
const commitHash = out.match(/\[.+ ([a-f0-9]+)\]/)?.[1] || 'unknown';
git(['push', remoteUrl, PR_HEAD_BRANCH], repoDir);
console.log(` ✅ persisted findings commit=${commitHash} push=${PR_HEAD_BRANCH}`);
}