Skip to content

Commit 57bed25

Browse files
authored
Merge pull request #2986 from harmw/emojis
feat: prettify PR message body
2 parents 524d058 + 1711802 commit 57bed25

File tree

3 files changed

+222
-55
lines changed

3 files changed

+222
-55
lines changed

modules/core/src/main/scala/org/scalasteward/core/forge/data/NewPullRequestData.scala

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,25 @@ object NewPullRequestData {
6666

6767
val updateInfoUrls = artifactIdToUpdateInfoUrls.getOrElse(u.mainArtifactId, Nil)
6868

69-
s"""|Updates $artifacts ${fromTo(u)}.
70-
|${renderUpdateInfoUrls(updateInfoUrls).getOrElse("")}""".stripMargin.trim
69+
s"""|## About this PR
70+
|📦 Updates $artifacts ${fromTo(u)}${showMajorUpgradeWarning(u)}
71+
|${renderUpdateInfoUrls(updateInfoUrls)
72+
.map(urls => s"\n📜 $urls")
73+
.getOrElse("")}""".stripMargin.trim
7174
},
7275
grouped = g => {
7376
val artifacts = g.updates
7477
.fproduct(u => artifactIdToUpdateInfoUrls.get(u.mainArtifactId).orEmpty)
7578
.map { case (u, updateInfoUrls) =>
76-
s"* ${artifactsWithOptionalUrl(u, artifactIdToUrl)} ${fromTo(u)}" +
77-
renderUpdateInfoUrls(updateInfoUrls).map(urls => s"\n + $urls").getOrElse("")
79+
s"* 📦 ${artifactsWithOptionalUrl(u, artifactIdToUrl)} ${fromTo(u)}${showMajorUpgradeWarning(u)}" +
80+
renderUpdateInfoUrls(updateInfoUrls)
81+
.map(urls => s"\n + 📜 $urls")
82+
.getOrElse("")
7883
}
7984
.mkString_("\n", "\n", "\n")
8085

81-
s"""|Updates:
86+
s"""|## About this PR
87+
|Updates:
8288
|$artifacts""".stripMargin.trim
8389
}
8490
)
@@ -90,18 +96,22 @@ object NewPullRequestData {
9096

9197
s"""|$updatesText
9298
|
99+
|## Usage
100+
|✅ **Please merge!**
93101
|
94102
|I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
95103
|
96104
|${skipVersionMessage}If you have any feedback, just mention me in the comments below.
97105
|
98106
|Configure Scala Steward for your repository with a [`${RepoConfigAlg.repoConfigBasename}`](${org.scalasteward.core.BuildInfo.gitHubUrl}/blob/${org.scalasteward.core.BuildInfo.gitHeadCommit}/docs/repo-specific-configuration.md) file.
99107
|
100-
|Have a fantastic day writing Scala!
108+
|_Have a fantastic day writing Scala!_
101109
|
102110
|${details.map(_.toHtml).mkString("\n")}
103111
|
112+
|<sup>
104113
|${labels.mkString("labels: ", ", ", "")}
114+
|</sup>
105115
|""".stripMargin.trim
106116
}
107117

@@ -118,7 +128,18 @@ object NewPullRequestData {
118128
}
119129

120130
def fromTo(update: Update.Single): String =
121-
s"from ${update.currentVersion} to ${update.nextVersion}"
131+
s"from `${update.currentVersion}` to `${update.nextVersion}`"
132+
133+
def showMajorUpgradeWarning(u: Update.Single): String = {
134+
val semVerVersions =
135+
(SemVer.parse(u.currentVersion.value), SemVer.parse(u.nextVersion.value)).tupled
136+
val semVerLabel = semVerVersions.flatMap { case (curr, next) =>
137+
SemVer.getChangeSpec(curr, next).map(c => c.render)
138+
}
139+
if (semVerLabel == Some("major"))
140+
s""
141+
else s""
142+
}
122143

123144
def artifactsWithOptionalUrl(update: Update.Single, artifactIdToUrl: Map[String, Uri]): String =
124145
update match {
@@ -150,7 +171,7 @@ object NewPullRequestData {
150171
)
151172

152173
Details(
153-
s"Files still referring to the old version $number",
174+
s"🔍 Files still referring to the old version $number",
154175
s"""The following files still refer to the old version $numberWithVersion.
155176
|You might want to review and update them manually.
156177
|```
@@ -161,7 +182,7 @@ object NewPullRequestData {
161182
}
162183

163184
def adjustFutureUpdates(update: Update): Details = Details(
164-
"Adjust future updates",
185+
"Adjust future updates",
165186
update.on(
166187
update = u =>
167188
s"""|Add this to your `${RepoConfigAlg.repoConfigBasename}` file to ignore future updates of this dependency:
@@ -188,7 +209,7 @@ object NewPullRequestData {
188209

189210
def configParsingErrorDetails(error: String): Details =
190211
Details(
191-
s"Note that the Scala Steward config file `${RepoConfigAlg.repoConfigBasename}` wasn't parsed correctly",
212+
s"Note that the Scala Steward config file `${RepoConfigAlg.repoConfigBasename}` wasn't parsed correctly",
192213
s"""|```
193214
|$error
194215
|```
@@ -213,7 +234,7 @@ object NewPullRequestData {
213234
s"* $name$createdChange\n$listElements"
214235
}
215236
.mkString("\n")
216-
Details("Applied Scalafix Migrations", body)
237+
Details("💡 Applied Scalafix Migrations", body)
217238
}
218239

219240
def from(

0 commit comments

Comments
 (0)