in modules/core/src/main/scala/org/scalasteward/core/forge/data/NewPullRequestData.scala [45:137]
def bodyFor(
update: Update,
edits: List[EditAttempt],
artifactIdToUrl: Map[String, Uri],
artifactIdToUpdateInfoUrls: Map[String, List[UpdateInfoUrl]],
filesWithOldVersion: List[String],
configParsingError: Option[String],
labels: List[String],
maximumPullRequestLength: Int
): String = {
val migrations = edits.collect { case scalafixEdit: ScalafixEdit => scalafixEdit }
val appliedMigrations = migrationNote(migrations)
val updateWithEdits = filterUpdateWithEditAttempts(update, edits)
val oldVersionDetails = oldVersionNote(filesWithOldVersion, updateWithEdits)
val details = List(
appliedMigrations,
oldVersionDetails,
adjustFutureUpdates(updateWithEdits).some,
configParsingError.map(configParsingErrorDetails)
).flatten
val updatesText = updateWithEdits.on(
update = u => {
val artifacts = artifactsWithOptionalUrl(u, artifactIdToUrl)
val updateInfoUrls = artifactIdToUpdateInfoUrls.getOrElse(u.mainArtifactId, Nil)
s"""|## About this PR
|š¦ Updates $artifacts ${fromTo(u)}${showMajorUpgradeWarning(u)}
|${renderUpdateInfoUrls(updateInfoUrls)
.map(urls => s"\nš $urls")
.getOrElse("")}""".stripMargin.trim
},
grouped = g => {
val artifacts = g.updates
.fproduct(u => artifactIdToUpdateInfoUrls.get(u.mainArtifactId).orEmpty)
.map { case (u, updateInfoUrls) =>
s"* š¦ ${artifactsWithOptionalUrl(u, artifactIdToUrl)} ${fromTo(u)}${showMajorUpgradeWarning(u)}" +
renderUpdateInfoUrls(updateInfoUrls)
.map(urls => s"\n + š $urls")
.getOrElse("")
}
.mkString_("\n", "\n", "\n")
s"""|## About this PR
|Updates:
|$artifacts""".stripMargin.trim
}
)
val skipVersionMessage = updateWithEdits.on(
_ => "If you'd like to skip this version, you can just close this PR. ",
_ => ""
)
val plainBody =
s"""|$updatesText
|
|## Usage
|ā
**Please merge!**
|
|I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
|
|${skipVersionMessage}If you have any feedback, just mention me in the comments below.
|
|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.
|
|_Have a fantastic day writing Scala!_
|
|${details.map(_.toHtml).mkString("\n")}
|
|<sup>
|${labels.mkString("labels: ", ", ", "")}
|</sup>
|""".stripMargin.trim
val metadataJson =
Json
.obj(
"Update" -> updateWithEdits.asJson,
"Labels" -> Json.fromValues(labels.map(_.asJson))
)
.toString
val bodyWithMetadata =
s"""$plainBody
|
|<!-- scala-steward = $metadataJson -->""".stripMargin
if (bodyWithMetadata.length < maximumPullRequestLength)
bodyWithMetadata
else plainBody
}