-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retract previously opened Pull Request
The `updates.retraced` section of the `scala-steward.conf` allows to declare updates that should be retracted. Each entry must have a `reason, a `doc` URL and a list of dependency patterns. Example: ``` updates.retracted = [ { reason = "Ignore version 3.6.0 as it is abandoned due to broken compatibility", doc = "https://contributors.scala-lang.org/t/broken-scala-3-6-0-release/6792", artifacts = [ { groupId = "org.scala-lang", artifactId = "scala3-compiler", version = { exact = "3.6.0" } } ] } ] ``` Retraction of Pull Request is only possible, if the workspace is persisted correctly. (https://github.com/scala-steward-org/scala-steward/blob/main/docs/faq.md#why-doesnt-self-hosted-scala-steward-close-obsolete-prs) Fixes: #3445
- Loading branch information
Showing
9 changed files
with
180 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
modules/core/src/main/scala/org/scalasteward/core/repoconfig/RetractedArtifact.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.scalasteward.core.repoconfig | ||
|
||
import io.circe.Codec | ||
import io.circe.generic.semiauto.deriveCodec | ||
import org.scalasteward.core.data.Update | ||
|
||
final case class RetractedArtifact( | ||
reason: String, | ||
doc: String, | ||
artifacts: List[UpdatePattern] = List.empty | ||
) { | ||
def isRetracted(updateSingle: Update.Single): Boolean = | ||
updateSingle.forArtifactIds.exists { updateForArtifactId => | ||
UpdatePattern | ||
.findMatch(artifacts, updateForArtifactId, include = true) | ||
.filteredVersions | ||
.nonEmpty | ||
} | ||
|
||
def retractionMsg: String = | ||
s"""|Retracted because of: ${reason}. | ||
| | ||
|Documentation: ${doc} | ||
|""".stripMargin.trim | ||
} | ||
|
||
object RetractedArtifact { | ||
implicit val retractedPatternCodec: Codec[RetractedArtifact] = | ||
deriveCodec | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
modules/core/src/test/scala/org/scalasteward/core/repoconfig/RetractedArtifactTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.scalasteward.core.repoconfig | ||
|
||
import org.scalasteward.core.TestSyntax._ | ||
|
||
import munit.FunSuite | ||
|
||
class RetractedArtifactTest extends FunSuite { | ||
private val retractedArtifact = RetractedArtifact( | ||
"a reason", | ||
"doc URI", | ||
List( | ||
UpdatePattern( | ||
"org.portable-scala".g, | ||
Some("sbt-scalajs-crossproject"), | ||
Some(VersionPattern(exact = Some("1.0.0"))) | ||
) | ||
) | ||
) | ||
|
||
test("isRetracted") { | ||
val update = ("org.portable-scala".g % "sbt-scalajs-crossproject".a % "0.9.2" %> "1.0.0").single | ||
assert(retractedArtifact.isRetracted(update)) | ||
} | ||
|
||
test("not isRetracted") { | ||
val update = ("org.portable-scala".g % "sbt-scalajs-crossproject".a % "0.9.2" %> "0.9.3").single | ||
assert(!retractedArtifact.isRetracted(update)) | ||
} | ||
} |