mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 13:53:15 +00:00
chore: Better git debug logging (#673)
This commit is contained in:
parent
8349cbb763
commit
162d66016e
1 changed files with 38 additions and 6 deletions
|
|
@ -284,14 +284,45 @@ export async function checkoutBranchAndCommit(
|
|||
);
|
||||
|
||||
if (pushRes instanceof Error) {
|
||||
logger.info("Failed to push changes, attempting to pull and push again");
|
||||
const errorFields =
|
||||
pushRes instanceof Error
|
||||
? {
|
||||
message: pushRes.message,
|
||||
name: pushRes.name,
|
||||
}
|
||||
: pushRes;
|
||||
|
||||
logger.error("Failed to push changes, attempting to pull and push again", {
|
||||
...errorFields,
|
||||
});
|
||||
|
||||
// attempt to git pull, then push again
|
||||
await sandbox.git.pull(
|
||||
absoluteRepoDir,
|
||||
"git",
|
||||
options.githubInstallationToken,
|
||||
const pullRes = await withRetry(
|
||||
async () => {
|
||||
return await sandbox.git.pull(
|
||||
absoluteRepoDir,
|
||||
"git",
|
||||
options.githubInstallationToken,
|
||||
);
|
||||
},
|
||||
{ retries: 1, delay: 0 },
|
||||
);
|
||||
logger.info("Successfully pulled changes. Pushing again.");
|
||||
|
||||
if (pullRes instanceof Error) {
|
||||
const errorFields =
|
||||
pullRes instanceof Error
|
||||
? {
|
||||
message: pullRes.message,
|
||||
name: pullRes.name,
|
||||
}
|
||||
: pullRes;
|
||||
logger.error("Failed to pull changes after a push failed.", {
|
||||
...errorFields,
|
||||
});
|
||||
} else {
|
||||
logger.info("Successfully pulled changes. Pushing again.");
|
||||
}
|
||||
|
||||
const pushRes2 = await withRetry(
|
||||
async () => {
|
||||
return await sandbox.git.push(
|
||||
|
|
@ -302,6 +333,7 @@ export async function checkoutBranchAndCommit(
|
|||
},
|
||||
{ retries: 3, delay: 0 },
|
||||
);
|
||||
|
||||
if (pushRes2 instanceof Error) {
|
||||
const gitStatus = await sandbox.git.status(absoluteRepoDir);
|
||||
const errorFields = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue