Skip to content
Snippets Groups Projects
Commit bd249c8a authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor(onboarding): simplify update text

De-dupplicates text in the onboarding PR and makes it closer to what the theoretical commit message would be.

Closes #1315, Closes #2211
parent 94535337
No related branches found
No related tags found
No related merge requests found
...@@ -23,30 +23,28 @@ function getPrList(config, branches) { ...@@ -23,30 +23,28 @@ function getPrList(config, branches) {
prDesc += branch.baseBranch prDesc += branch.baseBranch
? ` - Merge into: \`${branch.baseBranch}\`\n` ? ` - Merge into: \`${branch.baseBranch}\`\n`
: ''; : '';
const seen = [];
for (const upgrade of branch.upgrades) { for (const upgrade of branch.upgrades) {
let text = '';
if (upgrade.updateType === 'lockFileMaintenance') { if (upgrade.updateType === 'lockFileMaintenance') {
prDesc += ' - Regenerates lock file to use latest dependency versions'; text += ' - Regenerate lock files to use latest dependency versions';
} else { } else {
if (upgrade.updateType === 'pin') { if (upgrade.updateType === 'pin') {
prDesc += ' - Pins '; text += ' - Pin ';
} else { } else {
prDesc += ' - Upgrades '; text += ' - Upgrade ';
} }
if (upgrade.repositoryUrl) { if (upgrade.repositoryUrl) {
prDesc += `[${upgrade.depName}](${upgrade.repositoryUrl})`; text += `[${upgrade.depName}](${upgrade.repositoryUrl})`;
} else { } else {
prDesc += upgrade.depName.replace(prTitleRe, '@​$1'); text += upgrade.depName.replace(prTitleRe, '@​$1');
} }
if (upgrade.depType) { text += ` to \`${upgrade.newValue || upgrade.newDigest}\``;
prDesc += ` in \`${upgrade.depType}\` `; text += '\n';
} else { }
prDesc += ' '; if (!seen.includes(text)) {
} prDesc += text;
if (upgrade.updateType !== 'pin') { seen.push(text);
prDesc += `from \`${upgrade.currentValue}\` `;
}
prDesc += `to \`${upgrade.newValue || upgrade.newDigest}\``;
prDesc += '\n';
} }
} }
prDesc += '\n\n'; prDesc += '\n\n';
......
...@@ -18,8 +18,8 @@ With your current configuration, Renovate will create 2 Pull Requests: ...@@ -18,8 +18,8 @@ With your current configuration, Renovate will create 2 Pull Requests:
<summary>Pin dependencies</summary> <summary>Pin dependencies</summary>
- Branch name: \`renovate/pin-dependencies\` - Branch name: \`renovate/pin-dependencies\`
- Pins [a](https://a) in \`devDependencies\` to \`1.1.0\` - Pin [a](https://a) to \`1.1.0\`
- Pins b to \`1.5.3\` - Pin b to \`1.5.3\`
</details> </details>
...@@ -28,7 +28,7 @@ With your current configuration, Renovate will create 2 Pull Requests: ...@@ -28,7 +28,7 @@ With your current configuration, Renovate will create 2 Pull Requests:
<summary>Update a to v2</summary> <summary>Update a to v2</summary>
- Branch name: \`renovate/a-2.x\` - Branch name: \`renovate/a-2.x\`
- Upgrades [a](https://a) in \`devDependencies\` from \`^1.0.0\` to \`2.0.1\` - Upgrade [a](https://a) to \`2.0.1\`
</details> </details>
...@@ -47,7 +47,7 @@ With your current configuration, Renovate will create 1 Pull Request: ...@@ -47,7 +47,7 @@ With your current configuration, Renovate will create 1 Pull Request:
- Schedule: [\\"before 5am\\"] - Schedule: [\\"before 5am\\"]
- Branch name: \`renovate/lock-file-maintenance\` - Branch name: \`renovate/lock-file-maintenance\`
- Regenerates lock file to use latest dependency versions - Regenerate lock files to use latest dependency versions
</details> </details>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment