You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/Generation.kt
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,11 @@ public enum class ClientType {
55
55
* via `@file:Import(...)`.
56
56
*/
57
57
CLIENT_SIDE_GENERATION,
58
+
59
+
/**
60
+
* The binding is going to be provided in a versioned JAR.
61
+
*/
62
+
VERSIONED_JAR,
58
63
}
59
64
60
65
privateobject Types {
@@ -118,7 +123,7 @@ private fun generateActionBindingSourceCode(
118
123
): String {
119
124
val fileSpec =
120
125
FileSpec.builder(
121
-
if (clientType ==ClientType.BUNDLED_WITH_LIB) {
126
+
if (clientType !=ClientType.CLIENT_SIDE_GENERATION) {
Copy file name to clipboardExpand all lines: action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationTest.kt
+146Lines changed: 146 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -532,4 +532,150 @@ class GenerationTest : FunSpec({
532
532
533
533
""".trimIndent()
534
534
}
535
+
536
+
test("action binding generated for the versioned JAR") {
537
+
// given
538
+
val actionManifest =
539
+
Metadata(
540
+
name =
541
+
"""
542
+
Do something cool
543
+
and describe it in multiple lines
544
+
""".trimIndent(),
545
+
description = "This is a test description that should be put in the KDoc comment for a class",
546
+
inputs =
547
+
mapOf(
548
+
"foo-bar" to
549
+
Input(
550
+
description = "Short description",
551
+
required = true,
552
+
default = null,
553
+
),
554
+
"baz-goo" to
555
+
Input(
556
+
description =
557
+
"""
558
+
Just another input
559
+
with multiline description
560
+
""".trimIndent(),
561
+
deprecationMessage = "this is deprecated",
562
+
required = true,
563
+
default = null,
564
+
),
565
+
),
566
+
)
567
+
val coords = ActionCoords("john-smith", "action-for-generated-jar", "v3")
568
+
569
+
// when
570
+
val binding =
571
+
coords.generateBinding(
572
+
metadataRevision = FromLockfile,
573
+
metadata = actionManifest,
574
+
clientType = ClientType.VERSIONED_JAR,
575
+
inputTypings =
576
+
Pair(
577
+
mapOf(
578
+
"baz-goo" to EnumTyping(null, listOf("helloworld"), listOf("HelloWorld")),
579
+
),
580
+
ACTION,
581
+
),
582
+
)
583
+
584
+
// then
585
+
//language=kotlin
586
+
binding.kotlinCode shouldBe
587
+
"""
588
+
// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
589
+
// changes will be overwritten with the next binding code regeneration.
590
+
// See https://github.com/typesafegithub/github-workflows-kt for more info.
0 commit comments