mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(cleanup): Add pr exists check
This commit is contained in:
parent
4eb20e0e57
commit
f6980b51f2
1 changed files with 3 additions and 3 deletions
|
@ -18,15 +18,15 @@ async function pruneStaleBranches(config, branchList) {
|
||||||
if (renovateBranches.indexOf('renovate/lock-file-maintenance') !== -1) {
|
if (renovateBranches.indexOf('renovate/lock-file-maintenance') !== -1) {
|
||||||
logger.debug('Checking lock file branch');
|
logger.debug('Checking lock file branch');
|
||||||
const pr = await config.api.getBranchPr('renovate/lock-file-maintenance');
|
const pr = await config.api.getBranchPr('renovate/lock-file-maintenance');
|
||||||
if (pr.isClosed) {
|
if (pr && pr.isClosed) {
|
||||||
logger.info(
|
logger.info(
|
||||||
'Deleting lock file maintenance branch as PR has been closed'
|
'Deleting lock file maintenance branch as PR has been closed'
|
||||||
);
|
);
|
||||||
await config.api.deleteBranch('renovate/lock-file-maintenance');
|
await config.api.deleteBranch('renovate/lock-file-maintenance');
|
||||||
} else if (pr.isUnmergeable) {
|
} else if (pr && pr.isUnmergeable) {
|
||||||
logger.info('Deleting lock file maintenance branch as it is unmergeable');
|
logger.info('Deleting lock file maintenance branch as it is unmergeable');
|
||||||
await config.api.deleteBranch('renovate/lock-file-maintenance');
|
await config.api.deleteBranch('renovate/lock-file-maintenance');
|
||||||
} else if (pr.changed_files === 0) {
|
} else if (pr && pr.changed_files === 0) {
|
||||||
logger.info(
|
logger.info(
|
||||||
'Deleting lock file maintenance branch as it has no changed files'
|
'Deleting lock file maintenance branch as it has no changed files'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue