-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show release notes URL from POM in PR body #2863
Conversation
Codecov ReportBase: 86.97% // Head: 88.23% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2863 +/- ##
==========================================
+ Coverage 86.97% 88.23% +1.26%
==========================================
Files 156 157 +1
Lines 2994 3018 +24
Branches 201 203 +2
==========================================
+ Hits 2604 2663 +59
+ Misses 390 355 -35
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I dug around a bit to see if I could find anything and the only thing I found is that some release plugins will use this same convention. For example you can see this in a couple apache Maven projects that use
I like Thanks for diving into this @fthomas! |
I agree with that and also think that it could be less likely that people adopt that property if it is tied to Scala Steward. At least I wouldn't want to sprinkle my POMs with tool specific properties. |
Btw, I'd like to note that the idea of adding a release notes URL to the POM has been discussed before in the |
modules/core/src/test/scala/org/scalasteward/core/nurture/NurtureAlgTest.scala
Show resolved
Hide resolved
I just looked at the POM of Cats 2.9.0. It contains these properties: <properties>
<info.apiURL>https://www.javadoc.io/doc/org.typelevel/cats-docs_2.13/2.9.0/</info.apiURL>
<info.versionScheme>early-semver</info.versionScheme>
</properties> Both come from the corresponding sbt settings |
The last commit changed the key to |
Awesome. I don't want to steal your thunder so I didn't do it, but you might want to announce this new feature in https://contributors.scala-lang.org/ so that more people are aware of it. Basically all over the place, ha. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏼 👏🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you update the reference to the new property in the PR description, there you are still referring to project.properties.releaseNotesUrl
modules/core/src/main/scala/org/scalasteward/core/coursier/CoursierAlg.scala
Outdated
Show resolved
Hide resolved
Duplicates could have happened if the URL from the POM was the same as one of the URLs constructed in possibleReleaseRelatedUrls.
Update: See #2863 (comment) for a better way to add this property in sbt. Btw, in sbt the pomPostProcess := { (node: xml.Node) =>
val releaseNotesUrl =
<info.releaseNotesUrl>https://www.scala-lang.org/blog/2022/11/07/scala-3.2.1-released.html</info.releaseNotesUrl>
var updated = false
val updatedChild = node.child.map {
case e: xml.Elem if e.label == "properties" =>
updated = true; e.copy(child = e.child :+ releaseNotesUrl)
case n => n
}
node match {
case e: xml.Elem if updated => e.copy(child = updatedChild)
case e: xml.Elem => e.copy(child = e.child :+ <properties>{releaseNotesUrl}</properties>)
case n => n
}
} This adds the Not sure if there is an easier way to do it. It would be certainly nice if this wouldn't be so complicated. |
In Mill, you can add the property as follows: // in object foo extends PublishModule
def publishProperties = super.publishProperties() ++ Map(
"info.releaseNotesURL" -> "https://www.scala-lang.org/blog/2022/11/07/scala-3.2.1-released.html"
)
|
@fthomas I think there is a simpler way for sbt: projectID ~= { id =>
val releaseNotesURL =
"info.releaseNotesURL" -> "https://www.scala-lang.org/blog/2022/11/07/scala-3.2.1-released.html"
id.withExtraAttributes(id.extraAttributes + releaseNotesURL)
} |
Awesome, thanks @julienrf! |
This is a follow-up to #2863. Before this change, the `info.releaseNotesUrl` property from the POM was ignored if `project.scm.url` and `project.url` were not set. With this change the `releaseNotesUrl` is added to the PR even if the other two are not set.
Just announced this on Scala Contributors: https://contributors.scala-lang.org/t/add-release-notes-urls-to-your-poms/6059 Update: Here is a GitHub search of issues that mention |
This PR shows a release notes URL from the POM in the body of PRs.
Currently, Scala Steward uses the project.scm.url or project.url and tries to find release notes / change logs / version diffs from these URLs by constructing common URLs and checking if they exist. These are then added to the PRs.
With this change, Scala Steward also reads a release notes URL from a
project.properties."info.releaseNotesUrl"
element in the POM and shows it in the PR body. It allows library maintainers to have their release notes anywhere they want them to be and still have Scala Steward show them in PRs. Note that I just made up the namereleaseNotesUrl
for this feature.This has been partly motivated by com-lihaoyi/requests-scala#122. The changes in
CoursierAlg
also allow to extract more metadata in the future to maybe implement the idea @lefou mentioned in #2708 (comment)./ping @ckipp01 and @lefou since I mentioned this the other day on Discord.
Open questions:
releaseNotesUrl
or should the element name be prefixed withscalasteward.
or something like that?