mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: fortify get changelog to not error
Adds check for res before res.project and wraps in try/catch so that any future errors are ignored and don’t stop the PR. Fixes #2023
This commit is contained in:
parent
dbb8fac31c
commit
941d06172d
1 changed files with 4 additions and 0 deletions
|
@ -79,6 +79,7 @@ async function getChangeLogJSON(args) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isGHE &&
|
isGHE &&
|
||||||
|
res &&
|
||||||
res.project &&
|
res.project &&
|
||||||
res.project.githubBaseURL === gheBaseURL &&
|
res.project.githubBaseURL === gheBaseURL &&
|
||||||
process.env.GITHUB_ENDPOINT !== endpoint
|
process.env.GITHUB_ENDPOINT !== endpoint
|
||||||
|
@ -93,6 +94,9 @@ async function getChangeLogJSON(args) {
|
||||||
const output = await addReleaseNotes(res);
|
const output = await addReleaseNotes(res);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
} catch (err) /* istanbul ignore next */ {
|
||||||
|
logger.error({ err, message: err.message }, 'getChangeLogJSON error');
|
||||||
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
// wrap everything in a try/finally to ensure process.env.GITHUB_TOKEN is restored no matter if
|
// wrap everything in a try/finally to ensure process.env.GITHUB_TOKEN is restored no matter if
|
||||||
// getChangeLogJSON and addReleaseNotes succed or fails
|
// getChangeLogJSON and addReleaseNotes succed or fails
|
||||||
|
|
Loading…
Reference in a new issue