UNPKG

renovate

Version:

Automated dependency updates. Flexible so you don't need to be.

44 lines (43 loc) 1.48 kB
import { logger } from "../../../../../logger/index.js"; import { detectPlatform } from "../../../../../util/common.js"; import { get } from "../../../../../modules/versioning/index.js"; import api from "./api.js"; import { isNullOrUndefined } from "@sindresorhus/is"; //#region lib/workers/repository/update/pr/changelog/index.ts async function getChangeLogJSON(config) { const { sourceUrl, versioning, currentVersion, newVersion } = config; try { if (!(sourceUrl && currentVersion && newVersion)) return null; if (get(versioning).equals(currentVersion, newVersion)) return null; logger.debug(`Fetching changelog: ${sourceUrl} (${currentVersion} -> ${newVersion})`); const platform = detectPlatform(sourceUrl); if (isNullOrUndefined(platform)) { logger.info({ sourceUrl, hostType: platform }, "Unknown platform, skipping changelog fetching."); return null; } const changeLogSource = getChangeLogSourceFor(platform); if (isNullOrUndefined(changeLogSource)) { logger.info({ sourceUrl, hostType: platform }, "Unknown changelog source, skipping changelog fetching."); return null; } return await changeLogSource.getChangeLogJSON(config); } catch (err) /* istanbul ignore next */ { logger.error({ config, err }, "getChangeLogJSON error"); return null; } } function getChangeLogSourceFor(platform) { return api.get(platform) ?? null; } //#endregion export { getChangeLogJSON }; //# sourceMappingURL=index.js.map