mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
27 lines
639 B
JavaScript
27 lines
639 B
JavaScript
const addrs = require('email-addresses');
|
|
|
|
module.exports = {
|
|
setMeta,
|
|
};
|
|
|
|
function setMeta(config) {
|
|
const { gitAuthor } = config;
|
|
if (gitAuthor) {
|
|
let gitAuthorParsed;
|
|
try {
|
|
gitAuthorParsed = addrs.parseOneAddress(gitAuthor);
|
|
} catch (err) /* istanbul ignore next */ {
|
|
logger.debug({ gitAuthor, err }, 'Error parsing gitAuthor');
|
|
}
|
|
// istanbul ignore if
|
|
if (!gitAuthorParsed) {
|
|
throw new Error(
|
|
'Configured gitAuthor is not parsed as valid RFC5322 format'
|
|
);
|
|
}
|
|
global.gitAuthor = {
|
|
name: gitAuthorParsed.name,
|
|
email: gitAuthorParsed.address,
|
|
};
|
|
}
|
|
}
|