mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Choose tasks at random
This commit is contained in:
parent
8324be321a
commit
344088ae5b
1 changed files with 8 additions and 1 deletions
|
@ -8,6 +8,7 @@ import java.nio.file.Files
|
||||||
import java.nio.file.SimpleFileVisitor
|
import java.nio.file.SimpleFileVisitor
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("io.papermc.paperweight.core") version "2.0.0-SNAPSHOT" apply false
|
id("io.papermc.paperweight.core") version "2.0.0-SNAPSHOT" apply false
|
||||||
|
@ -98,7 +99,13 @@ tasks.register("gibWork") {
|
||||||
val end = html.indexOf("```", start + beginMarker.length)
|
val end = html.indexOf("```", start + beginMarker.length)
|
||||||
val taskList = html.substring(start + beginMarker.length, end)
|
val taskList = html.substring(start + beginMarker.length, end)
|
||||||
|
|
||||||
val next = taskList.split("\\n").first { it.startsWith("- [ ]") }.replace("- [ ] ", "")
|
// Extract all incomplete tasks and select a random one
|
||||||
|
val incompleteTasks = taskList.split("\\n").filter { it.startsWith("- [ ]") }.map { it.replace("- [ ] ", "") }
|
||||||
|
if (incompleteTasks.isEmpty()) {
|
||||||
|
error("No incomplete tasks found in the task list.")
|
||||||
|
}
|
||||||
|
|
||||||
|
val next = incompleteTasks[Random.nextInt(incompleteTasks.size)]
|
||||||
|
|
||||||
println("checking out $next...")
|
println("checking out $next...")
|
||||||
val dir = patchesFolder.resolve("unapplied").resolve(next)
|
val dir = patchesFolder.resolve("unapplied").resolve(next)
|
||||||
|
|
Loading…
Reference in a new issue