Skip to content
Snippets Groups Projects
Commit 8eb3a037 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: correct autoclose logging

parent b2a64339
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,10 @@ async function cleanUpBranches(
`PRUNING-DISABLED: Would update pr ${pr.number} to ${pr.title} - autoclosed`
);
} else {
logger.info(
{ branchName, prNo: pr.number, prTitle: pr.title },
'Autoclosing PR'
);
await platform.updatePr({
number: pr.number,
prTitle: `${pr.title} - autoclosed`,
......@@ -40,8 +44,11 @@ async function cleanUpBranches(
}
}
logger.debug({ branch: branchName }, `Deleting orphan branch`);
if (branchIsModified) {
logger.debug(
{ branch: branchName },
`Skipping orphan branch deletion as branch has been modified`
);
if (pr) {
logger.debug(
{ prNo: pr?.number, prTitle: pr?.title },
......@@ -65,11 +72,9 @@ async function cleanUpBranches(
`PRUNING-DISABLED: Would deleting orphan branch ${branchName}`
);
} else {
logger.debug({ branch: branchName }, `Deleting orphan branch`);
await deleteBranch(branchName);
}
if (pr && !branchIsModified) {
logger.info({ prNo: pr.number, prTitle: pr.title }, 'PR autoclosed');
}
} catch (err) /* istanbul ignore next */ {
if (err.message !== REPOSITORY_CHANGED) {
logger.warn({ err, branch: branchName }, 'Error pruning branch');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment