Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5cf5950bd | |||
| eae73092ad | |||
| 69624a542e | |||
| 8aa273b8bd | |||
| 00458d4eb2 | |||
| 894ece033b | |||
| fe2a513fbb | |||
| 2193bdd4d6 | |||
| af51ffacee |
+5
-5
@@ -1,9 +1,9 @@
|
|||||||
FROM node:20-slim
|
FROM alpine
|
||||||
|
|
||||||
# force rebuild to ensure git is installed
|
RUN apk add --no-cache bash nodejs npm git \
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
&& node --version \
|
||||||
git \
|
&& npm --version \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& git --version
|
||||||
|
|
||||||
WORKDIR /action
|
WORKDIR /action
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -1,17 +1,16 @@
|
|||||||
import { spawnSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { GITEA_SERVER_URL, GITEA_REPOSITORY, GITEA_TOKEN, PR_HEAD_BRANCH, FINDINGS_PATH } from './config.js';
|
import { GITEA_SERVER_URL, GITEA_REPOSITORY, GITEA_TOKEN, PR_HEAD_BRANCH, FINDINGS_PATH } from './config.js';
|
||||||
|
|
||||||
function git(args, cwd) {
|
function git(args, cwd) {
|
||||||
const result = spawnSync('git', args, { cwd, encoding: 'utf8' });
|
return execSync(`git ${args.map(a => `'${a.replace(/'/g, "'\\''")}'`).join(' ')}`, { cwd, encoding: 'utf8' }).trim();
|
||||||
if (result.error) throw result.error;
|
|
||||||
if (result.status !== 0) throw new Error((result.stderr || result.stdout || '').trim());
|
|
||||||
return (result.stdout || '').trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function commitAndPush(workspace) {
|
export async function commitAndPush(workspace) {
|
||||||
const repoDir = path.join(workspace, GITEA_REPOSITORY);
|
const repoDir = path.join(workspace, GITEA_REPOSITORY);
|
||||||
const remoteUrl = GITEA_SERVER_URL.replace(/\/$/, '').replace('https://', `https://${GITEA_TOKEN}@`).replace('http://', `http://${GITEA_TOKEN}@`) + `/${GITEA_REPOSITORY}.git`;
|
const remoteUrl = GITEA_SERVER_URL.replace(/\/$/, '')
|
||||||
|
.replace('https://', `https://${GITEA_TOKEN}@`)
|
||||||
|
.replace('http://', `http://${GITEA_TOKEN}@`) + `/${GITEA_REPOSITORY}.git`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
git(['config', 'user.email', 'ai-review[bot]@gitea'], repoDir);
|
git(['config', 'user.email', 'ai-review[bot]@gitea'], repoDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user