danger/kotlin

Danger execution fails for PR assigned to a closed milestone

doodeec opened this issue · 1 comments

PR is in an inactive (closed) milestone. It seem to be the cause for a serialization error.

kotlinx.serialization.SerializationException: systems.danger.kotlin.models.github.GitHubMilestoneState does not contain element with name 'closed'
    at kotlinx.serialization.json.internal.TreeJsonDecoderKt.getElementIndexOrThrow(TreeJsonDecoder.kt:271)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeEnum(StreamingJsonDecoder.kt:225)
    at systems.danger.kotlin.models.github.GitHubMilestoneState$$serializer.deserialize(GitHub.kt)
    at systems.danger.kotlin.models.github.GitHubMilestoneState$$serializer.deserialize(GitHub.kt:304)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:33)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:41)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:63)
    at systems.danger.kotlin.models.github.GitHubMilestone$$serializer.deserialize(GitHub.kt)
    at systems.danger.kotlin.models.github.GitHubMilestone$$serializer.deserialize(GitHub.kt:332)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:33)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:41)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:72)
    at systems.danger.kotlin.models.github.GitHubIssue$$serializer.deserialize(GitHub.kt)
    at systems.danger.kotlin.models.github.GitHubIssue$$serializer.deserialize(GitHub.kt:243)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:33)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:41)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:63)
    at systems.danger.kotlin.models.github.GitHub$$serializer.deserialize(GitHub.kt)
    at systems.danger.kotlin.models.github.GitHub$$serializer.deserialize(GitHub.kt:14)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:33)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:41)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:72)
    at systems.danger.kotlin.models.danger.DangerDSL$$serializer.deserialize(DangerDSL.kt)
    at systems.danger.kotlin.models.danger.DangerDSL$$serializer.deserialize(DangerDSL.kt:15)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:33)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:41)
    at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:63)
    at systems.danger.kotlin.models.danger.DSL$$serializer.deserialize(DangerDSL.kt)
    at systems.danger.kotlin.models.danger.DSL$$serializer.deserialize(DangerDSL.kt:10)
    at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:33)
    at kotlinx.serialization.json.Json.decodeFromString(Json.kt:85)
    at systems.danger.kotlin.MainDangerRunner.<init>(MainDangerRunner.kt:130)
    at systems.danger.kotlin.MainScriptKt.Danger(MainScript.kt:39)
    at Dangerfile_df.<init>(Dangerfile.df.kts:69)

dangerfile

danger(args) {
    onGitHub {
        // Milestone is required
        if (pullRequest.milestone == null) {
            fail("PR is required to have a milestone.")
        }
    }
}

Environment: GitHub Enterprise Server 2.22.4

probably a typo in


close -> closed