feat: branch protection + deps caching

This commit is contained in:
2026-05-31 02:44:12 -05:00
parent d5d2e5b58e
commit 19671c6299
6 changed files with 40 additions and 23 deletions
+11 -13
View File
@@ -169,9 +169,18 @@ export async function main(): Promise<MainResult> {
const modes = computeModes(agentId);
const outputSchema = resolveOutputSchema();
let defaultBranch = "main";
try {
const repoData = await gitea.request(
"GET /repos/{owner}/{repo}",
{ owner: repoContext.owner, repo: repoContext.name }
);
defaultBranch = (repoData.data as { default_branch?: string }).default_branch ?? "main";
} catch { /* keep "main" fallback */ }
toolContext = {
agentId,
repo: repoContext,
repo: { ...repoContext, defaultBranch },
payload,
gitea,
gitToken: botToken,
@@ -185,17 +194,6 @@ export async function main(): Promise<MainResult> {
tmpdir,
};
let defaultBranch: string | undefined;
try {
const repoData = await gitea.request(
"GET /repos/{owner}/{repo}",
{ owner: repoContext.owner, repo: repoContext.name }
);
defaultBranch = (repoData.data as { default_branch?: string }).default_branch;
} catch {
defaultBranch = "main";
}
await using mcpHttpServer = await startMcpHttpServer(toolContext, { outputSchema });
toolContext.mcpServerUrl = mcpHttpServer.url;
log.info(`» MCP server started at ${mcpHttpServer.url}`);
@@ -205,7 +203,7 @@ export async function main(): Promise<MainResult> {
const instructions = resolveInstructions({
payload,
repo: { owner: repoContext.owner, name: repoContext.name, ...(defaultBranch ? { defaultBranch } : {}) },
repo: { owner: repoContext.owner, name: repoContext.name, defaultBranch },
modes,
agentId,
outputSchema,