mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 15:03:16 +00:00
feat: Dont open empty PRs (#782)
This commit is contained in:
parent
f316685de3
commit
30b0bfb639
1 changed files with 18 additions and 1 deletions
|
|
@ -113,10 +113,27 @@ export async function openPullRequest(
|
|||
);
|
||||
}
|
||||
|
||||
const repoPath = getRepoAbsolutePath(state.targetRepository);
|
||||
|
||||
// First, verify that there are changed files
|
||||
const gitDiffRes = await sandbox.process.executeCommand(
|
||||
`git diff --name-only ${state.targetRepository.branch ?? ""}`,
|
||||
repoPath,
|
||||
);
|
||||
if (gitDiffRes.exitCode !== 0 || gitDiffRes.result.trim().length === 0) {
|
||||
// no changed files
|
||||
const sandboxDeleted = await deleteSandbox(sandboxSessionId);
|
||||
return {
|
||||
...(sandboxDeleted && {
|
||||
sandboxSessionId: undefined,
|
||||
dependenciesInstalled: false,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
let branchName = state.branchName;
|
||||
let updatedTaskPlan: TaskPlan | undefined;
|
||||
|
||||
const repoPath = getRepoAbsolutePath(state.targetRepository);
|
||||
const changedFiles = await getChangedFilesStatus(repoPath, sandbox, config);
|
||||
|
||||
if (changedFiles.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue