renovate
Version:
Automated dependency updates. Flexible so you don't need to be.
47 lines (46 loc) • 2.75 kB
JavaScript
import { regEx } from "../../../../util/regex.js";
import { logger } from "../../../../logger/index.js";
import { emojify } from "../../../../util/emoji.js";
//#region lib/workers/repository/onboarding/pr/pr-list.ts
function getExpectedPrList(config, branches) {
logger.debug("getExpectedPrList()");
logger.trace({ config });
let prDesc = `\n### What to Expect\n\n`;
if (!branches.length) return `${prDesc}It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away.\n`;
prDesc += `With your current configuration, Renovate will create ${branches.length} Pull Request`;
prDesc += branches.length > 1 ? `s:\n\n` : `:\n\n`;
for (const branch of branches) {
const prTitleRe = regEx(/@([a-z]+\/[a-z]+)/);
prDesc += `<details>\n<summary>${branch.prTitle.replace(prTitleRe, "@​$1")}</summary>\n\n`;
if (branch.schedule?.length) prDesc += ` - Schedule: ${JSON.stringify(branch.schedule)}\n`;
prDesc += ` - Branch name: \`${branch.branchName}\`\n`;
prDesc += branch.baseBranch ? ` - Merge into: \`${branch.baseBranch}\`\n` : "";
const seen = [];
for (const upgrade of branch.upgrades) {
let text = "";
if (upgrade.updateType === "lockFileMaintenance") text += " - Regenerate lock files to use latest dependency versions";
else {
if (upgrade.updateType === "pin") text += " - Pin ";
else text += " - Upgrade ";
if (upgrade.sourceUrl) text += `[${upgrade.depName}](${upgrade.sourceUrl})`;
else text += upgrade.depName.replace(prTitleRe, "@​$1");
text += upgrade.isLockfileUpdate ? ` to \`${upgrade.newVersion}\`` : ` to \`${upgrade.newDigest ?? upgrade.newValue}\``;
text += "\n";
}
if (!seen.includes(text)) {
prDesc += text;
seen.push(text);
}
}
prDesc += "\n\n";
prDesc += "</details>\n\n";
}
const prHourlyLimit = config.prHourlyLimit;
const commitHourlyLimit = config.commitHourlyLimit;
if (commitHourlyLimit > 0 && commitHourlyLimit < 5 && commitHourlyLimit < branches.length) prDesc += emojify(`\n\n:children_crossing: Branch creation and rebasing will be limited to maximum ${commitHourlyLimit} per hour, so it doesn't swamp any CI resources or overwhelm the project. See docs for \`commitHourlyLimit\` for details.\n\n`);
else if (prHourlyLimit > 0 && prHourlyLimit < 5 && prHourlyLimit < branches.length) prDesc += emojify(`\n\n:children_crossing: PR creation will be limited to maximum ${prHourlyLimit} per hour, so it doesn't swamp any CI resources or overwhelm the project. See [docs for \`prHourlyLimit\`](https://docs.renovatebot.com/configuration-options/#prhourlylimit) for details.\n\n`);
return prDesc;
}
//#endregion
export { getExpectedPrList };
//# sourceMappingURL=pr-list.js.map