mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-05 17:42:12 +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) {
|
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
|
// attempt to git pull, then push again
|
||||||
await sandbox.git.pull(
|
const pullRes = await withRetry(
|
||||||
absoluteRepoDir,
|
async () => {
|
||||||
"git",
|
return await sandbox.git.pull(
|
||||||
options.githubInstallationToken,
|
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(
|
const pushRes2 = await withRetry(
|
||||||
async () => {
|
async () => {
|
||||||
return await sandbox.git.push(
|
return await sandbox.git.push(
|
||||||
|
|
@ -302,6 +333,7 @@ export async function checkoutBranchAndCommit(
|
||||||
},
|
},
|
||||||
{ retries: 3, delay: 0 },
|
{ retries: 3, delay: 0 },
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pushRes2 instanceof Error) {
|
if (pushRes2 instanceof Error) {
|
||||||
const gitStatus = await sandbox.git.status(absoluteRepoDir);
|
const gitStatus = await sandbox.git.status(absoluteRepoDir);
|
||||||
const errorFields = {
|
const errorFields = {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue