Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
2aa9c3c8
Commit
2aa9c3c8
authored
6 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
fix: try/catch branch prune
parent
ffc04a02
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/workers/repository/finalise/prune.js
+11
-8
11 additions, 8 deletions
lib/workers/repository/finalise/prune.js
with
11 additions
and
8 deletions
lib/workers/repository/finalise/prune.js
+
11
−
8
View file @
2aa9c3c8
...
@@ -3,7 +3,6 @@ module.exports = {
...
@@ -3,7 +3,6 @@ module.exports = {
};
};
async
function
pruneStaleBranches
(
config
,
branchList
)
{
async
function
pruneStaleBranches
(
config
,
branchList
)
{
// TODO: try/catch
logger
.
debug
(
'
Removing any stale branches
'
);
logger
.
debug
(
'
Removing any stale branches
'
);
logger
.
trace
({
config
},
`pruneStaleBranches`
);
logger
.
trace
({
config
},
`pruneStaleBranches`
);
logger
.
debug
(
`config.repoIsOnboarded=
${
config
.
repoIsOnboarded
}
`
);
logger
.
debug
(
`config.repoIsOnboarded=
${
config
.
repoIsOnboarded
}
`
);
...
@@ -41,13 +40,17 @@ async function pruneStaleBranches(config, branchList) {
...
@@ -41,13 +40,17 @@ async function pruneStaleBranches(config, branchList) {
return
;
return
;
}
}
for
(
const
branchName
of
remainingBranches
)
{
for
(
const
branchName
of
remainingBranches
)
{
logger
.
info
({
branch
:
branchName
},
`Deleting orphan branch`
);
try
{
const
pr
=
await
platform
.
findPr
(
branchName
,
null
,
'
open
'
);
const
pr
=
await
platform
.
findPr
(
branchName
,
null
,
'
open
'
);
if
(
pr
)
{
if
(
pr
)
{
await
platform
.
updatePr
(
pr
.
number
,
`
${
pr
.
title
}
- autoclosed`
);
await
platform
.
updatePr
(
pr
.
number
,
`
${
pr
.
title
}
- autoclosed`
);
logger
.
info
({
prNo
:
pr
.
number
,
prTitle
:
pr
.
title
},
'
PR autoclosed
'
);
logger
.
info
({
prNo
:
pr
.
number
,
prTitle
:
pr
.
title
},
'
PR autoclosed
'
);
}
const
closePr
=
true
;
await
platform
.
deleteBranch
(
branchName
,
closePr
);
logger
.
info
({
branch
:
branchName
},
`Deleting orphan branch`
);
}
catch
(
err
)
/* istanbul ignore next */
{
logger
.
warn
({
err
,
branch
:
branchName
},
'
Error pruning branch
'
);
}
}
const
closePr
=
true
;
await
platform
.
deleteBranch
(
branchName
,
closePr
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment