diff --git a/.github/workflows/bindings-server.main.kts b/.github/workflows/bindings-server.main.kts
index bfb8713a01..f772d26485 100755
--- a/.github/workflows/bindings-server.main.kts
+++ b/.github/workflows/bindings-server.main.kts
@@ -98,20 +98,20 @@ workflow(
cleanMavenLocal()
run(
- name = "Execute the script using the bindings from the server",
+ name = "Execute the script using the bindings from the server with binding version v1",
command = """
- mv .github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings.main.kts
- .github/workflows/test-script-consuming-jit-bindings.main.kts
+ mv .github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
+ .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
""".trimIndent(),
)
cleanMavenLocal()
run(
- name = "Execute the script using the bindings from the server with v1 route",
+ name = "Execute the script using the bindings from the server with binding version v2",
command = """
- mv .github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
- .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
+ mv .github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
+ .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
""".trimIndent(),
)
@@ -133,7 +133,7 @@ workflow(
runWithSpecificKotlinVersion(
kotlinVersion = newestNotCompatibleVersion,
command = """
- cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
+ cp .github/workflows/test-script-consuming-jit-bindings-v1.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
${failsWithPhraseInLogs(
command = ".github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts",
// This test depicts the current behavior that the served bindings aren't
@@ -146,7 +146,7 @@ workflow(
runWithSpecificKotlinVersion(
kotlinVersion = oldestCompatibleVersion,
command = """
- cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
+ cp .github/workflows/test-script-consuming-jit-bindings-v1.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
.github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
""".trimIndent(),
)
@@ -161,11 +161,11 @@ workflow(
run(
name = "Fetch maven-metadata.xml for top-level action",
- command = "curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep 'v4'",
+ command = "curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep 'binding_version_v1___v4'",
)
run(
name = "Fetch maven-metadata.xml for nested action",
- command = "curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep 'v4'",
+ command = "curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep 'binding_version_v1___v4'",
)
run(
diff --git a/.github/workflows/bindings-server.yaml b/.github/workflows/bindings-server.yaml
index 560b3b4a10..29dadb4297 100644
--- a/.github/workflows/bindings-server.yaml
+++ b/.github/workflows/bindings-server.yaml
@@ -69,18 +69,18 @@ jobs:
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-5'
- name: 'Execute the script using the bindings from the server'
+ name: 'Execute the script using the bindings from the server with binding version v1'
run: |-
- mv .github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings.main.kts
- .github/workflows/test-script-consuming-jit-bindings.main.kts
+ mv .github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
+ .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
- id: 'step-6'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-7'
- name: 'Execute the script using the bindings from the server with v1 route'
+ name: 'Execute the script using the bindings from the server with binding version v2'
run: |-
- mv .github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
- .github/workflows/test-script-consuming-jit-bindings-v1.main.kts
+ mv .github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
+ .github/workflows/test-script-consuming-jit-bindings-v2.main.kts
- id: 'step-8'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
@@ -100,7 +100,7 @@ jobs:
- id: 'step-12'
name: 'Execute the script using the bindings from the server, using older Kotlin (1.9.0) as consumer'
run: |2-
- cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
+ cp .github/workflows/test-script-consuming-jit-bindings-v1.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
(.github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts || true) >> output.txt 2>&1
grep "was compiled with an incompatible version of Kotlin" output.txt
- id: 'step-13'
@@ -114,7 +114,7 @@ jobs:
- id: 'step-15'
name: 'Execute the script using the bindings from the server, using older Kotlin (2.0.0) as consumer'
run: |-
- cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
+ cp .github/workflows/test-script-consuming-jit-bindings-v1.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
.github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
- id: 'step-16'
name: 'Compile a Gradle project using the bindings from the server'
@@ -123,10 +123,10 @@ jobs:
./gradlew build --refresh-dependencies
- id: 'step-17'
name: 'Fetch maven-metadata.xml for top-level action'
- run: 'curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep ''v4'''
+ run: 'curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep ''binding_version_v1___v4'''
- id: 'step-18'
name: 'Fetch maven-metadata.xml for nested action'
- run: 'curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep ''v4'''
+ run: 'curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep ''binding_version_v1___v4'''
- id: 'step-19'
name: 'Print server logs'
run: 'cat jit-binding-server/logs/server.log'
diff --git a/.github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts b/.github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts
index d69e5679b4..5f5f471854 100755
--- a/.github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts
+++ b/.github/workflows/test-script-consuming-jit-bindings-v1.main.do-not-compile.kts
@@ -1,6 +1,6 @@
#!/usr/bin/env kotlin
@file:Repository("https://repo.maven.apache.org/maven2/")
-@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.13.0")
+@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.0")
@file:Repository("http://localhost:8080")
diff --git a/.github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts b/.github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts
new file mode 100755
index 0000000000..08f115ad6f
--- /dev/null
+++ b/.github/workflows/test-script-consuming-jit-bindings-v2.main.do-not-compile.kts
@@ -0,0 +1,33 @@
+#!/usr/bin/env kotlin
+@file:Repository("https://repo.maven.apache.org/maven2/")
+@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.0.0")
+
+@file:Repository("http://localhost:8080")
+
+// Regular, top-level action.
+@file:DependsOn("actions:checkout:binding_version_v2___v4-beta")
+
+// Nested action.
+@file:DependsOn("gradle:actions__setup-gradle:binding_version_v2___v3-beta")
+
+// Using specific version.
+@file:DependsOn("actions:cache:binding_version_v2___v3.3.3-beta")
+
+// Always untyped action.
+@file:DependsOn("typesafegithub:always-untyped-action-for-tests:binding_version_v2___v1-beta")
+
+import io.github.typesafegithub.workflows.actions.actions.Cache
+import io.github.typesafegithub.workflows.actions.actions.Checkout
+import io.github.typesafegithub.workflows.actions.actions.Checkout_Untyped
+import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
+import io.github.typesafegithub.workflows.actions.typesafegithub.AlwaysUntypedActionForTests_Untyped
+
+println(Checkout_Untyped(fetchTags_Untyped = "false"))
+println(Checkout(fetchTags = false))
+println(Checkout(fetchTags_Untyped = "false"))
+println(AlwaysUntypedActionForTests_Untyped(foobar_Untyped = "baz"))
+println(ActionsSetupGradle())
+println(Cache(path = listOf("some-path"), key = "some-key"))
+
+// Ensure that 'copy(...)' method is exposed.
+Checkout(fetchTags = false).copy(fetchTags = true)
diff --git a/.github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts b/.github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts
deleted file mode 100755
index 008cb0c4b8..0000000000
--- a/.github/workflows/test-script-consuming-jit-bindings.main.do-not-compile.kts
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env kotlin
-@file:Repository("https://repo.maven.apache.org/maven2/")
-@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.7.0")
-@file:DependsOn("io.kotest:kotest-assertions-core:5.9.1")
-
-@file:Repository("http://localhost:8080")
-
-// Regular, top-level action.
-@file:DependsOn("actions:checkout:v4")
-
-// Nested action.
-@file:DependsOn("gradle:actions__setup-gradle:v3")
-
-// Using specific version.
-@file:DependsOn("actions:cache:v3.3.3")
-
-// Using version ranges.
-@file:DependsOn("gradle:actions__dependency-submission___major:[v3.3.1,v4-alpha)")
-@file:DependsOn("gradle:actions__wrapper-validation___minor:[v4.2.1,v4.3-alpha)")
-
-// To test case-insensitivity when referring to action names/owners.
-@file:DependsOn("Actions:Setup-Node:v4")
-
-// Always untyped action.
-@file:DependsOn("typesafegithub:always-untyped-action-for-tests:v1")
-
-// Action version pinned to a commit.
-@file:DependsOn("actions:setup-python___commit_lenient:v6.0.0__e797f83bcb11b83ae66e0230d6156d7c80228e7c")
-
-import io.github.typesafegithub.workflows.actions.actions.Cache
-import io.github.typesafegithub.workflows.actions.actions.Checkout
-import io.github.typesafegithub.workflows.actions.actions.SetupNode
-import io.github.typesafegithub.workflows.actions.actions.SetupPython
-import io.github.typesafegithub.workflows.actions.actions.Checkout_Untyped
-import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
-import io.github.typesafegithub.workflows.actions.gradle.ActionsDependencySubmission_Untyped
-import io.github.typesafegithub.workflows.actions.gradle.ActionsWrapperValidation
-import io.github.typesafegithub.workflows.actions.typesafegithub.AlwaysUntypedActionForTests_Untyped
-import io.kotest.matchers.shouldBe
-
-println(Checkout_Untyped(fetchTags_Untyped = "false"))
-println(Checkout(fetchTags = false))
-println(Checkout(fetchTags_Untyped = "false"))
-println(AlwaysUntypedActionForTests_Untyped(foobar_Untyped = "baz"))
-println(ActionsSetupGradle())
-println(Cache(path = listOf("some-path"), key = "some-key"))
-println(SetupNode())
-
-ActionsDependencySubmission_Untyped().actionVersion shouldBe "v3"
-ActionsWrapperValidation().actionVersion shouldBe "v4.2"
-
-// Ensure that 'copy(...)' method is exposed.
-Checkout(fetchTags = false).copy(fetchTags = true)
-
-SetupPython().actionVersion shouldBe "e797f83bcb11b83ae66e0230d6156d7c80228e7c"
diff --git a/action-binding-generator/api/action-binding-generator.api b/action-binding-generator/api/action-binding-generator.api
index bddb0f0105..59dca9d637 100644
--- a/action-binding-generator/api/action-binding-generator.api
+++ b/action-binding-generator/api/action-binding-generator.api
@@ -218,6 +218,7 @@ public abstract interface class io/github/typesafegithub/workflows/actionbinding
public final class io/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion : java/lang/Enum {
public static final field V1 Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;
+ public static final field V2 Lio/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getLibraryVersion ()Ljava/lang/String;
public final fun isDeprecated ()Z
diff --git a/action-binding-generator/build.gradle.kts b/action-binding-generator/build.gradle.kts
index 61c39916d7..005ad76b23 100644
--- a/action-binding-generator/build.gradle.kts
+++ b/action-binding-generator/build.gradle.kts
@@ -22,7 +22,9 @@ dependencies {
implementation(projects.sharedInternal)
testImplementation("io.ktor:ktor-client-mock:3.4.3")
+ testImplementation(kotlin("reflect"))
testImplementation(projects.githubWorkflowsKt)
+ testImplementation(projects.testUtils)
}
kotlin {
diff --git a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion.kt b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion.kt
index c61cdcd180..38479db4d5 100644
--- a/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion.kt
+++ b/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/versioning/BindingVersion.kt
@@ -6,6 +6,7 @@ public enum class BindingVersion(
public val libraryVersion: String,
) {
V1(isExperimental = false, libraryVersion = "3.7.0"),
+ V2(libraryVersion = "3.7.0"),
;
override fun toString(): String = super.toString().lowercase()
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Utils.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Utils.kt
index 3d34ac5282..c908c99695 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Utils.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Utils.kt
@@ -1,9 +1,15 @@
package io.github.typesafegithub.workflows.actionbindinggenerator
import io.github.typesafegithub.workflows.actionbindinggenerator.generation.ActionBinding
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.kotest.engine.mapError
import io.kotest.matchers.Matcher.Companion.failure
import io.kotest.matchers.shouldBe
+import java.lang.reflect.InvocationTargetException
import java.nio.file.Paths
+import kotlin.reflect.full.primaryConstructor
+import kotlin.reflect.jvm.isAccessible
fun List.shouldContainAndMatchFile(path: String) {
val binding =
@@ -37,3 +43,29 @@ fun List.shouldContainAndMatchFile(path: String) {
}
private fun String.removeWindowsNewLines(): String = replace("\r\n", "\n")
+
+fun constructAction(
+ owner: String,
+ classBaseName: String,
+ bindingVersion: BindingVersion,
+ arguments: Map = emptyMap(),
+): Action<*> {
+ val constructor =
+ Class
+ .forName("io.github.typesafegithub.workflows.actions.$owner.${classBaseName}Binding${bindingVersion.name}")
+ .let {
+ @Suppress("UNCHECKED_CAST")
+ it as Class>
+ }.kotlin
+ .let { it.primaryConstructor ?: it.constructors.first() }
+ .apply { isAccessible = true }
+ return runCatching {
+ constructor.callBy(
+ arguments.mapKeys { (key, _) ->
+ constructor.parameters.first { it.name == key }
+ },
+ )
+ }.mapError {
+ if (it is InvocationTargetException) it.targetException else it
+ }.getOrThrow()
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSubAction.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionBindingV1WithSubAction.kt
similarity index 87%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSubAction.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionBindingV1WithSubAction.kt
index db9d00a071..e8acfb53af 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSubAction.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionBindingV1WithSubAction.kt
@@ -22,13 +22,13 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with/tree/v3/sub/action)
+ * [Action on GitHub](https://github.com/john-smith/action-binding-v1-with/tree/v3/sub/action)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithSubAction private constructor(
+public data class ActionBindingV1WithSubAction private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -37,7 +37,7 @@ public data class ActionWithSubAction private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with/sub/action", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-binding-v1-with/sub/action", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionBindingV2WithSubAction.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionBindingV2WithSubAction.kt
new file mode 100644
index 0000000000..149627e220
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionBindingV2WithSubAction.kt
@@ -0,0 +1,62 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * Action: Action With No Inputs
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-binding-v2-with/tree/v3/sub/action)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionBindingV2WithSubAction private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-binding-v2-with/sub/action", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-binding-v2-with/sub/action@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-binding-v2-with/sub/action@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV1.kt
similarity index 83%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV1.kt
index 6d6b8884e3..993ff514aa 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV1.kt
@@ -28,7 +28,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-all-types-of-inputs)
+ * [Action on GitHub](https://github.com/john-smith/action-with-all-types-of-inputs-binding-v1)
*
* @param fooBar <required> Short description
* @param fooBar_Untyped <required> Short description
@@ -58,7 +58,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithAllTypesOfInputs private constructor(
+public data class ActionWithAllTypesOfInputsBindingV1 private constructor(
/**
* <required> Short description
*/
@@ -102,7 +102,7 @@ public data class ActionWithAllTypesOfInputs private constructor(
/**
* <required> Enumeration
*/
- public val finBin: ActionWithAllTypesOfInputs.Bin? = null,
+ public val finBin: ActionWithAllTypesOfInputsBindingV1.Bin? = null,
/**
* <required> Enumeration
*/
@@ -110,7 +110,7 @@ public data class ActionWithAllTypesOfInputs private constructor(
/**
* <required> Integer with special value
*/
- public val gooZen: ActionWithAllTypesOfInputs.Zen? = null,
+ public val gooZen: ActionWithAllTypesOfInputsBindingV1.Zen? = null,
/**
* <required> Integer with special value
*/
@@ -118,7 +118,7 @@ public data class ActionWithAllTypesOfInputs private constructor(
/**
* <required> Enum with custom naming
*/
- public val bahEnum: ActionWithAllTypesOfInputs.BahEnum? = null,
+ public val bahEnum: ActionWithAllTypesOfInputsBindingV1.BahEnum? = null,
/**
* <required> Enum with custom naming
*/
@@ -142,7 +142,7 @@ public data class ActionWithAllTypesOfInputs private constructor(
/**
* List of enums
*/
- public val listEnums: List? = null,
+ public val listEnums: List? = null,
/**
* List of enums
*/
@@ -150,7 +150,7 @@ public data class ActionWithAllTypesOfInputs private constructor(
/**
* List of integer with special values
*/
- public val listIntSpecial: List? = null,
+ public val listIntSpecial: List? = null,
/**
* List of integer with special values
*/
@@ -163,7 +163,7 @@ public data class ActionWithAllTypesOfInputs private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-all-types-of-inputs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-all-types-of-inputs-binding-v1", _customVersion ?: "v3") {
init {
require(!((fooBar != null) && (fooBar_Untyped != null))) {
"Only fooBar or fooBar_Untyped must be set, but not both"
@@ -247,19 +247,19 @@ public data class ActionWithAllTypesOfInputs private constructor(
intPint_Untyped: String? = null,
floPint: Float? = null,
floPint_Untyped: String? = null,
- finBin: ActionWithAllTypesOfInputs.Bin? = null,
+ finBin: ActionWithAllTypesOfInputsBindingV1.Bin? = null,
finBin_Untyped: String? = null,
- gooZen: ActionWithAllTypesOfInputs.Zen? = null,
+ gooZen: ActionWithAllTypesOfInputsBindingV1.Zen? = null,
gooZen_Untyped: String? = null,
- bahEnum: ActionWithAllTypesOfInputs.BahEnum? = null,
+ bahEnum: ActionWithAllTypesOfInputsBindingV1.BahEnum? = null,
bahEnum_Untyped: String? = null,
listStrings: List? = null,
listStrings_Untyped: String? = null,
listInts: List? = null,
listInts_Untyped: String? = null,
- listEnums: List? = null,
+ listEnums: List? = null,
listEnums_Untyped: String? = null,
- listIntSpecial: List? = null,
+ listIntSpecial: List? = null,
listIntSpecial_Untyped: String? = null,
_customInputs: Map = mapOf(),
_customVersion: String? = null,
@@ -301,21 +301,21 @@ public data class ActionWithAllTypesOfInputs private constructor(
public sealed class Bin(
public val stringValue: String,
) {
- public object Bam123 : ActionWithAllTypesOfInputs.Bin("bam-123")
+ public object Bam123 : ActionWithAllTypesOfInputsBindingV1.Bin("bam-123")
- public object Bam123_2 : ActionWithAllTypesOfInputs.Bin("bam/123")
+ public object Bam123_2 : ActionWithAllTypesOfInputsBindingV1.Bin("bam/123")
- public object Bam123_3 : ActionWithAllTypesOfInputs.Bin("bam:123")
+ public object Bam123_3 : ActionWithAllTypesOfInputsBindingV1.Bin("bam:123")
- public object Baz123 : ActionWithAllTypesOfInputs.Bin("baz123")
+ public object Baz123 : ActionWithAllTypesOfInputsBindingV1.Bin("baz123")
- public object BooBar : ActionWithAllTypesOfInputs.Bin("boo-bar")
+ public object BooBar : ActionWithAllTypesOfInputsBindingV1.Bin("boo-bar")
- public object Foo : ActionWithAllTypesOfInputs.Bin("foo")
+ public object Foo : ActionWithAllTypesOfInputsBindingV1.Bin("foo")
public class Custom(
customStringValue: String,
- ) : ActionWithAllTypesOfInputs.Bin(customStringValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.Bin(customStringValue)
}
public sealed class Zen(
@@ -323,35 +323,35 @@ public data class ActionWithAllTypesOfInputs private constructor(
) {
public class Value(
requestedValue: Int,
- ) : ActionWithAllTypesOfInputs.Zen(requestedValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.Zen(requestedValue)
- public object Special1 : ActionWithAllTypesOfInputs.Zen(3)
+ public object Special1 : ActionWithAllTypesOfInputsBindingV1.Zen(3)
- public object Special2 : ActionWithAllTypesOfInputs.Zen(-1)
+ public object Special2 : ActionWithAllTypesOfInputsBindingV1.Zen(-1)
}
public sealed class BahEnum(
public val stringValue: String,
) {
- public object HelloWorld : ActionWithAllTypesOfInputs.BahEnum("helloworld")
+ public object HelloWorld : ActionWithAllTypesOfInputsBindingV1.BahEnum("helloworld")
public class Custom(
customStringValue: String,
- ) : ActionWithAllTypesOfInputs.BahEnum(customStringValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.BahEnum(customStringValue)
}
public sealed class MyEnum(
public val stringValue: String,
) {
- public object One : ActionWithAllTypesOfInputs.MyEnum("one")
+ public object One : ActionWithAllTypesOfInputsBindingV1.MyEnum("one")
- public object Three : ActionWithAllTypesOfInputs.MyEnum("three")
+ public object Three : ActionWithAllTypesOfInputsBindingV1.MyEnum("three")
- public object Two : ActionWithAllTypesOfInputs.MyEnum("two")
+ public object Two : ActionWithAllTypesOfInputsBindingV1.MyEnum("two")
public class Custom(
customStringValue: String,
- ) : ActionWithAllTypesOfInputs.MyEnum(customStringValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.MyEnum(customStringValue)
}
public sealed class MyInt(
@@ -359,9 +359,9 @@ public data class ActionWithAllTypesOfInputs private constructor(
) {
public class Value(
requestedValue: Int,
- ) : ActionWithAllTypesOfInputs.MyInt(requestedValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.MyInt(requestedValue)
- public object TheAnswer : ActionWithAllTypesOfInputs.MyInt(42)
+ public object TheAnswer : ActionWithAllTypesOfInputsBindingV1.MyInt(42)
}
public class Outputs(
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV1_Untyped.kt
similarity index 95%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs_Untyped.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV1_Untyped.kt
index 2bc6811da1..5be32947be 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputs_Untyped.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV1_Untyped.kt
@@ -45,7 +45,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-all-types-of-inputs)
+ * [Action on GitHub](https://github.com/john-smith/action-with-all-types-of-inputs-binding-v1)
*
* @param fooBar_Untyped Short description
* @param bazGoo_Untyped First boolean input!
@@ -64,10 +64,10 @@ import kotlin.collections.toTypedArray
*/
@Deprecated(
"Use the typed class instead",
- ReplaceWith("ActionWithAllTypesOfInputs"),
+ ReplaceWith("ActionWithAllTypesOfInputsBindingV1"),
)
@ExposedCopyVisibility
-public data class ActionWithAllTypesOfInputs_Untyped private constructor(
+public data class ActionWithAllTypesOfInputsBindingV1_Untyped private constructor(
/**
* Short description
*/
@@ -124,7 +124,7 @@ public data class ActionWithAllTypesOfInputs_Untyped private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-all-types-of-inputs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-all-types-of-inputs-binding-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
fooBar_Untyped: String,
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2.kt
new file mode 100644
index 0000000000..501232fb0f
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2.kt
@@ -0,0 +1,383 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Boolean
+import kotlin.ExposedCopyVisibility
+import kotlin.Float
+import kotlin.Int
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.List
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-all-types-of-inputs-binding-v2)
+ *
+ * @param fooBar <required> Short description
+ * @param fooBar_Untyped <required> Short description
+ * @param bazGoo <required> First boolean input!
+ * @param bazGoo_Untyped <required> First boolean input!
+ * @param binKin Boolean and nullable
+ * @param binKin_Untyped Boolean and nullable
+ * @param intPint <required> Integer
+ * @param intPint_Untyped <required> Integer
+ * @param floPint <required> Float
+ * @param floPint_Untyped <required> Float
+ * @param finBin <required> Enumeration
+ * @param finBin_Untyped <required> Enumeration
+ * @param gooZen <required> Integer with special value
+ * @param gooZen_Untyped <required> Integer with special value
+ * @param bahEnum <required> Enum with custom naming
+ * @param bahEnum_Untyped <required> Enum with custom naming
+ * @param listStrings List of strings
+ * @param listStrings_Untyped List of strings
+ * @param listInts List of integers
+ * @param listInts_Untyped List of integers
+ * @param listEnums List of enums
+ * @param listEnums_Untyped List of enums
+ * @param listIntSpecial List of integer with special values
+ * @param listIntSpecial_Untyped List of integer with special values
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithAllTypesOfInputsBindingV2 private constructor(
+ /**
+ * <required> Short description
+ */
+ public val fooBar: String? = null,
+ /**
+ * <required> Short description
+ */
+ public val fooBar_Untyped: String? = null,
+ /**
+ * <required> First boolean input!
+ */
+ public val bazGoo: Boolean? = null,
+ /**
+ * <required> First boolean input!
+ */
+ public val bazGoo_Untyped: String? = null,
+ /**
+ * Boolean and nullable
+ */
+ public val binKin: Boolean? = null,
+ /**
+ * Boolean and nullable
+ */
+ public val binKin_Untyped: String? = null,
+ /**
+ * <required> Integer
+ */
+ public val intPint: Int? = null,
+ /**
+ * <required> Integer
+ */
+ public val intPint_Untyped: String? = null,
+ /**
+ * <required> Float
+ */
+ public val floPint: Float? = null,
+ /**
+ * <required> Float
+ */
+ public val floPint_Untyped: String? = null,
+ /**
+ * <required> Enumeration
+ */
+ public val finBin: ActionWithAllTypesOfInputsBindingV2.Bin? = null,
+ /**
+ * <required> Enumeration
+ */
+ public val finBin_Untyped: String? = null,
+ /**
+ * <required> Integer with special value
+ */
+ public val gooZen: ActionWithAllTypesOfInputsBindingV2.Zen? = null,
+ /**
+ * <required> Integer with special value
+ */
+ public val gooZen_Untyped: String? = null,
+ /**
+ * <required> Enum with custom naming
+ */
+ public val bahEnum: ActionWithAllTypesOfInputsBindingV2.BahEnum? = null,
+ /**
+ * <required> Enum with custom naming
+ */
+ public val bahEnum_Untyped: String? = null,
+ /**
+ * List of strings
+ */
+ public val listStrings: List? = null,
+ /**
+ * List of strings
+ */
+ public val listStrings_Untyped: String? = null,
+ /**
+ * List of integers
+ */
+ public val listInts: List? = null,
+ /**
+ * List of integers
+ */
+ public val listInts_Untyped: String? = null,
+ /**
+ * List of enums
+ */
+ public val listEnums: List? = null,
+ /**
+ * List of enums
+ */
+ public val listEnums_Untyped: String? = null,
+ /**
+ * List of integer with special values
+ */
+ public val listIntSpecial: List? = null,
+ /**
+ * List of integer with special values
+ */
+ public val listIntSpecial_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-all-types-of-inputs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-all-types-of-inputs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-all-types-of-inputs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((fooBar != null) && (fooBar_Untyped != null))) {
+ "Only fooBar or fooBar_Untyped must be set, but not both"
+ }
+ require((fooBar != null) || (fooBar_Untyped != null)) {
+ "Either fooBar or fooBar_Untyped must be set, one of them is required"
+ }
+
+ require(!((bazGoo != null) && (bazGoo_Untyped != null))) {
+ "Only bazGoo or bazGoo_Untyped must be set, but not both"
+ }
+ require((bazGoo != null) || (bazGoo_Untyped != null)) {
+ "Either bazGoo or bazGoo_Untyped must be set, one of them is required"
+ }
+
+ require(!((binKin != null) && (binKin_Untyped != null))) {
+ "Only binKin or binKin_Untyped must be set, but not both"
+ }
+
+ require(!((intPint != null) && (intPint_Untyped != null))) {
+ "Only intPint or intPint_Untyped must be set, but not both"
+ }
+ require((intPint != null) || (intPint_Untyped != null)) {
+ "Either intPint or intPint_Untyped must be set, one of them is required"
+ }
+
+ require(!((floPint != null) && (floPint_Untyped != null))) {
+ "Only floPint or floPint_Untyped must be set, but not both"
+ }
+ require((floPint != null) || (floPint_Untyped != null)) {
+ "Either floPint or floPint_Untyped must be set, one of them is required"
+ }
+
+ require(!((finBin != null) && (finBin_Untyped != null))) {
+ "Only finBin or finBin_Untyped must be set, but not both"
+ }
+ require((finBin != null) || (finBin_Untyped != null)) {
+ "Either finBin or finBin_Untyped must be set, one of them is required"
+ }
+
+ require(!((gooZen != null) && (gooZen_Untyped != null))) {
+ "Only gooZen or gooZen_Untyped must be set, but not both"
+ }
+ require((gooZen != null) || (gooZen_Untyped != null)) {
+ "Either gooZen or gooZen_Untyped must be set, one of them is required"
+ }
+
+ require(!((bahEnum != null) && (bahEnum_Untyped != null))) {
+ "Only bahEnum or bahEnum_Untyped must be set, but not both"
+ }
+ require((bahEnum != null) || (bahEnum_Untyped != null)) {
+ "Either bahEnum or bahEnum_Untyped must be set, one of them is required"
+ }
+
+ require(!((listStrings != null) && (listStrings_Untyped != null))) {
+ "Only listStrings or listStrings_Untyped must be set, but not both"
+ }
+
+ require(!((listInts != null) && (listInts_Untyped != null))) {
+ "Only listInts or listInts_Untyped must be set, but not both"
+ }
+
+ require(!((listEnums != null) && (listEnums_Untyped != null))) {
+ "Only listEnums or listEnums_Untyped must be set, but not both"
+ }
+
+ require(!((listIntSpecial != null) && (listIntSpecial_Untyped != null))) {
+ "Only listIntSpecial or listIntSpecial_Untyped must be set, but not both"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooBar: String? = null,
+ fooBar_Untyped: String? = null,
+ bazGoo: Boolean? = null,
+ bazGoo_Untyped: String? = null,
+ binKin: Boolean? = null,
+ binKin_Untyped: String? = null,
+ intPint: Int? = null,
+ intPint_Untyped: String? = null,
+ floPint: Float? = null,
+ floPint_Untyped: String? = null,
+ finBin: ActionWithAllTypesOfInputsBindingV2.Bin? = null,
+ finBin_Untyped: String? = null,
+ gooZen: ActionWithAllTypesOfInputsBindingV2.Zen? = null,
+ gooZen_Untyped: String? = null,
+ bahEnum: ActionWithAllTypesOfInputsBindingV2.BahEnum? = null,
+ bahEnum_Untyped: String? = null,
+ listStrings: List? = null,
+ listStrings_Untyped: String? = null,
+ listInts: List? = null,
+ listInts_Untyped: String? = null,
+ listEnums: List? = null,
+ listEnums_Untyped: String? = null,
+ listIntSpecial: List? = null,
+ listIntSpecial_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooBar = fooBar, fooBar_Untyped = fooBar_Untyped, bazGoo = bazGoo, bazGoo_Untyped = bazGoo_Untyped, binKin = binKin, binKin_Untyped = binKin_Untyped, intPint = intPint, intPint_Untyped = intPint_Untyped, floPint = floPint, floPint_Untyped = floPint_Untyped, finBin = finBin, finBin_Untyped = finBin_Untyped, gooZen = gooZen, gooZen_Untyped = gooZen_Untyped, bahEnum = bahEnum, bahEnum_Untyped = bahEnum_Untyped, listStrings = listStrings, listStrings_Untyped = listStrings_Untyped, listInts = listInts, listInts_Untyped = listInts_Untyped, listEnums = listEnums, listEnums_Untyped = listEnums_Untyped, listIntSpecial = listIntSpecial, listIntSpecial_Untyped = listIntSpecial_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ fooBar?.let { "foo-bar" to it },
+ fooBar_Untyped?.let { "foo-bar" to it },
+ bazGoo?.let { "baz-goo" to it.toString() },
+ bazGoo_Untyped?.let { "baz-goo" to it },
+ binKin?.let { "bin-kin" to it.toString() },
+ binKin_Untyped?.let { "bin-kin" to it },
+ intPint?.let { "int-pint" to it.toString() },
+ intPint_Untyped?.let { "int-pint" to it },
+ floPint?.let { "flo-pint" to it.toString() },
+ floPint_Untyped?.let { "flo-pint" to it },
+ finBin?.let { "fin-bin" to it.stringValue },
+ finBin_Untyped?.let { "fin-bin" to it },
+ gooZen?.let { "goo-zen" to it.integerValue.toString() },
+ gooZen_Untyped?.let { "goo-zen" to it },
+ bahEnum?.let { "bah-enum" to it.stringValue },
+ bahEnum_Untyped?.let { "bah-enum" to it },
+ listStrings?.let { "list-strings" to it.joinToString(",") },
+ listStrings_Untyped?.let { "list-strings" to it },
+ listInts?.let { "list-ints" to it.joinToString(",") { it.toString() } },
+ listInts_Untyped?.let { "list-ints" to it },
+ listEnums?.let { "list-enums" to it.joinToString(",") { it.stringValue } },
+ listEnums_Untyped?.let { "list-enums" to it },
+ listIntSpecial?.let { "list-int-special" to it.joinToString(",") { it.integerValue.toString() } },
+ listIntSpecial_Untyped?.let { "list-int-special" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
+
+ public sealed class Bin(
+ public val stringValue: String,
+ ) {
+ public object Bam123 : ActionWithAllTypesOfInputsBindingV2.Bin("bam-123")
+
+ public object Bam123_2 : ActionWithAllTypesOfInputsBindingV2.Bin("bam/123")
+
+ public object Bam123_3 : ActionWithAllTypesOfInputsBindingV2.Bin("bam:123")
+
+ public object Baz123 : ActionWithAllTypesOfInputsBindingV2.Bin("baz123")
+
+ public object BooBar : ActionWithAllTypesOfInputsBindingV2.Bin("boo-bar")
+
+ public object Foo : ActionWithAllTypesOfInputsBindingV2.Bin("foo")
+
+ public class Custom(
+ customStringValue: String,
+ ) : ActionWithAllTypesOfInputsBindingV2.Bin(customStringValue)
+ }
+
+ public sealed class Zen(
+ public val integerValue: Int,
+ ) {
+ public class Value(
+ requestedValue: Int,
+ ) : ActionWithAllTypesOfInputsBindingV2.Zen(requestedValue)
+
+ public object Special1 : ActionWithAllTypesOfInputsBindingV2.Zen(3)
+
+ public object Special2 : ActionWithAllTypesOfInputsBindingV2.Zen(-1)
+ }
+
+ public sealed class BahEnum(
+ public val stringValue: String,
+ ) {
+ public object HelloWorld : ActionWithAllTypesOfInputsBindingV2.BahEnum("helloworld")
+
+ public class Custom(
+ customStringValue: String,
+ ) : ActionWithAllTypesOfInputsBindingV2.BahEnum(customStringValue)
+ }
+
+ public sealed class MyEnum(
+ public val stringValue: String,
+ ) {
+ public object One : ActionWithAllTypesOfInputsBindingV2.MyEnum("one")
+
+ public object Three : ActionWithAllTypesOfInputsBindingV2.MyEnum("three")
+
+ public object Two : ActionWithAllTypesOfInputsBindingV2.MyEnum("two")
+
+ public class Custom(
+ customStringValue: String,
+ ) : ActionWithAllTypesOfInputsBindingV2.MyEnum(customStringValue)
+ }
+
+ public sealed class MyInt(
+ public val integerValue: Int,
+ ) {
+ public class Value(
+ requestedValue: Int,
+ ) : ActionWithAllTypesOfInputsBindingV2.MyInt(requestedValue)
+
+ public object TheAnswer : ActionWithAllTypesOfInputsBindingV2.MyInt(42)
+ }
+
+ public class Outputs(
+ stepId: String,
+ ) : Action.Outputs(stepId) {
+ /**
+ * Cool output!
+ */
+ public val bazGoo: String = "steps.$stepId.outputs.baz-goo"
+ }
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2_Untyped.kt
new file mode 100644
index 0000000000..596d9c327a
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2_Untyped.kt
@@ -0,0 +1,186 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Deprecated
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * ```text
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!! WARNING !!!
+ * !!! !!!
+ * !!! This action binding has no typings provided. All inputs will !!!
+ * !!! have a default type of String. !!!
+ * !!! To be able to use this action in a type-safe way, ask the !!!
+ * !!! action's owner to provide the typings using !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing !!!
+ * !!! !!!
+ * !!! or if it's impossible, contribute typings to a community-driven !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing-catalog !!!
+ * !!! !!!
+ * !!! This '_Untyped' binding will be available even once the typings !!!
+ * !!! are added. !!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ```
+ *
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-all-types-of-inputs-binding-v2)
+ *
+ * @param fooBar_Untyped Short description
+ * @param bazGoo_Untyped First boolean input!
+ * @param binKin_Untyped Boolean and nullable
+ * @param intPint_Untyped Integer
+ * @param floPint_Untyped Float
+ * @param finBin_Untyped Enumeration
+ * @param gooZen_Untyped Integer with special value
+ * @param bahEnum_Untyped Enum with custom naming
+ * @param listStrings_Untyped List of strings
+ * @param listInts_Untyped List of integers
+ * @param listEnums_Untyped List of enums
+ * @param listIntSpecial_Untyped List of integer with special values
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@Deprecated(
+ "Use the typed class instead",
+ ReplaceWith("ActionWithAllTypesOfInputsBindingV2"),
+)
+@ExposedCopyVisibility
+public data class ActionWithAllTypesOfInputsBindingV2_Untyped private constructor(
+ /**
+ * Short description
+ */
+ public val fooBar_Untyped: String,
+ /**
+ * First boolean input!
+ */
+ public val bazGoo_Untyped: String,
+ /**
+ * Boolean and nullable
+ */
+ public val binKin_Untyped: String? = null,
+ /**
+ * Integer
+ */
+ public val intPint_Untyped: String,
+ /**
+ * Float
+ */
+ public val floPint_Untyped: String,
+ /**
+ * Enumeration
+ */
+ public val finBin_Untyped: String,
+ /**
+ * Integer with special value
+ */
+ public val gooZen_Untyped: String,
+ /**
+ * Enum with custom naming
+ */
+ public val bahEnum_Untyped: String,
+ /**
+ * List of strings
+ */
+ public val listStrings_Untyped: String? = null,
+ /**
+ * List of integers
+ */
+ public val listInts_Untyped: String? = null,
+ /**
+ * List of enums
+ */
+ public val listEnums_Untyped: String? = null,
+ /**
+ * List of integer with special values
+ */
+ public val listIntSpecial_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-all-types-of-inputs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-all-types-of-inputs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-all-types-of-inputs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooBar_Untyped: String,
+ bazGoo_Untyped: String,
+ binKin_Untyped: String? = null,
+ intPint_Untyped: String,
+ floPint_Untyped: String,
+ finBin_Untyped: String,
+ gooZen_Untyped: String,
+ bahEnum_Untyped: String,
+ listStrings_Untyped: String? = null,
+ listInts_Untyped: String? = null,
+ listEnums_Untyped: String? = null,
+ listIntSpecial_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooBar_Untyped = fooBar_Untyped, bazGoo_Untyped = bazGoo_Untyped, binKin_Untyped = binKin_Untyped, intPint_Untyped = intPint_Untyped, floPint_Untyped = floPint_Untyped, finBin_Untyped = finBin_Untyped, gooZen_Untyped = gooZen_Untyped, bahEnum_Untyped = bahEnum_Untyped, listStrings_Untyped = listStrings_Untyped, listInts_Untyped = listInts_Untyped, listEnums_Untyped = listEnums_Untyped, listIntSpecial_Untyped = listIntSpecial_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ "foo-bar" to fooBar_Untyped,
+ "baz-goo" to bazGoo_Untyped,
+ binKin_Untyped?.let { "bin-kin" to it },
+ "int-pint" to intPint_Untyped,
+ "flo-pint" to floPint_Untyped,
+ "fin-bin" to finBin_Untyped,
+ "goo-zen" to gooZen_Untyped,
+ "bah-enum" to bahEnum_Untyped,
+ listStrings_Untyped?.let { "list-strings" to it },
+ listInts_Untyped?.let { "list-ints" to it },
+ listEnums_Untyped?.let { "list-enums" to it },
+ listIntSpecial_Untyped?.let { "list-int-special" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
+
+ public class Outputs(
+ stepId: String,
+ ) : Action.Outputs(stepId) {
+ /**
+ * Cool output!
+ */
+ public val bazGoo: String = "steps.$stepId.outputs.baz-goo"
+ }
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsTest.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsTest.kt
index 65098f0291..9eef7b76be 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsTest.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsTest.kt
@@ -1,169 +1,281 @@
package io.github.typesafegithub.workflows.actionbindinggenerator.bindingsfromunittests
-import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithAllTypesOfInputs
+import io.github.typesafegithub.workflows.actionbindinggenerator.constructAction
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion.V1
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion.V2
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithAllTypesOfInputsBindingV1
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithAllTypesOfInputsBindingV2
+import io.github.typesafegithub.workflows.testutils.withAllBindingVersions
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
class ActionWithAllTypesOfInputsTest : DescribeSpec({
- it("correctly translates all types of inputs") {
- // given
- val action = ActionWithAllTypesOfInputs(
- fooBar = "test",
- bazGoo = true,
- binKin = false,
- intPint = 43,
- floPint = 123.456f,
- finBin = ActionWithAllTypesOfInputs.Bin.BooBar,
- gooZen = ActionWithAllTypesOfInputs.Zen.Special1,
- bahEnum = ActionWithAllTypesOfInputs.BahEnum.HelloWorld,
- listStrings = listOf("hello", "world"),
- listInts = listOf(1, 42),
- listEnums = listOf(ActionWithAllTypesOfInputs.MyEnum.One, ActionWithAllTypesOfInputs.MyEnum.Three),
- listIntSpecial = listOf(ActionWithAllTypesOfInputs.MyInt.TheAnswer, ActionWithAllTypesOfInputs.MyInt.Value(0))
- )
+ withAllBindingVersions { bindingVersion ->
+ it("correctly translates all types of inputs") {
+ // given
+ val action = constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "test",
+ "bazGoo" to true,
+ "binKin" to false,
+ "intPint" to 43,
+ "floPint" to 123.456f,
+ "finBin" to bindingVersion.finBin,
+ "gooZen" to bindingVersion.gooZen,
+ "bahEnum" to bindingVersion.bahEnum,
+ "listStrings" to listOf("hello", "world"),
+ "listInts" to listOf(1, 42),
+ "listEnums" to bindingVersion.listEnums,
+ "listIntSpecial" to bindingVersion.listIntSpecial,
+ ),
+ )
- // when
- val yaml = action.toYamlArguments()
-
- // then
- yaml shouldBe linkedMapOf(
- "foo-bar" to "test",
- "baz-goo" to "true",
- "bin-kin" to "false",
- "int-pint" to "43",
- "flo-pint" to "123.456",
- "fin-bin" to "boo-bar",
- "goo-zen" to "3",
- "bah-enum" to "helloworld",
- "list-strings" to "hello,world",
- "list-ints" to "1,42",
- "list-enums" to "one,three",
- "list-int-special" to "42,0"
- )
+ // when
+ val yaml = action.toYamlArguments()
+
+ // then
+ yaml shouldBe linkedMapOf(
+ "foo-bar" to "test",
+ "baz-goo" to "true",
+ "bin-kin" to "false",
+ "int-pint" to "43",
+ "flo-pint" to "123.456",
+ "fin-bin" to "boo-bar",
+ "goo-zen" to "3",
+ "bah-enum" to "helloworld",
+ "list-strings" to "hello,world",
+ "list-ints" to "1,42",
+ "list-enums" to "one,three",
+ "list-int-special" to "42,0"
+ )
+ }
+
+ it("works for custom values") {
+ // given
+ val action = constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "test",
+ "bazGoo" to true,
+ "binKin" to false,
+ "intPint" to 43,
+ "floPint" to 123.456f,
+ "finBin" to bindingVersion.customFinBin,
+ "gooZen" to bindingVersion.customGooZen,
+ "bahEnum" to bindingVersion.customBahEnum,
+ ),
+ )
+
+ // when
+ val yaml = action.toYamlArguments()
+
+ // then
+ yaml shouldBe linkedMapOf(
+ "foo-bar" to "test",
+ "baz-goo" to "true",
+ "bin-kin" to "false",
+ "int-pint" to "43",
+ "flo-pint" to "123.456",
+ "fin-bin" to "this-is-custom!",
+ "goo-zen" to "123",
+ "bah-enum" to "very-custom",
+ )
+ }
+
+ it("untyped input is sufficient for required input") {
+ // given
+ val action = constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "test",
+ "bazGoo_Untyped" to "\${{ 1 == 1 }}",
+ "binKin" to false,
+ "intPint" to 43,
+ "floPint" to 123.456f,
+ "finBin" to bindingVersion.customFinBin,
+ "gooZen" to bindingVersion.customGooZen,
+ "bahEnum" to bindingVersion.customBahEnum,
+ ),
+ )
+
+ // when
+ val yaml = action.toYamlArguments()
+
+ // then
+ yaml shouldBe linkedMapOf(
+ "foo-bar" to "test",
+ "baz-goo" to "\${{ 1 == 1 }}",
+ "bin-kin" to "false",
+ "int-pint" to "43",
+ "flo-pint" to "123.456",
+ "fin-bin" to "this-is-custom!",
+ "goo-zen" to "123",
+ "bah-enum" to "very-custom",
+ )
+ }
+
+ it("validates required inputs are not missing") {
+ // expect
+ val exception =
+ shouldThrow {
+ constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ )
+ }
+ exception.message shouldBe "Either fooBar or fooBar_Untyped must be set, one of them is required"
+ }
+
+ it("validates required inputs are not supplied typed and untyped") {
+ // expect
+ val exception =
+ shouldThrow {
+ constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "test",
+ "fooBar_Untyped" to "untyped test",
+ ),
+ )
+ }
+ exception.message shouldBe "Only fooBar or fooBar_Untyped must be set, but not both"
+ }
+
+ it("validates not-required inputs are not supplied typed and untyped") {
+ // expect
+ val exception =
+ shouldThrow {
+ constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "test",
+ "bazGoo_Untyped" to "\${{ 1 == 1 }}",
+ "binKin" to false,
+ "intPint" to 43,
+ "floPint" to 123.456f,
+ "finBin" to bindingVersion.customFinBin,
+ "gooZen" to bindingVersion.customGooZen,
+ "bahEnum" to bindingVersion.customBahEnum,
+ "listStrings" to listOf("test"),
+ "listStrings_Untyped" to "untyped test",
+ ),
+ )
+ }
+ exception.message shouldBe "Only listStrings or listStrings_Untyped must be set, but not both"
+ }
+
+ it("exposes copy method") {
+ // given
+ val action = constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithAllTypesOfInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "test",
+ "bazGoo" to true,
+ "binKin" to false,
+ "intPint" to 43,
+ "floPint" to 123.456f,
+ "finBin" to bindingVersion.finBin,
+ "gooZen" to bindingVersion.gooZen,
+ "bahEnum" to bindingVersion.bahEnum,
+ "listStrings" to listOf("hello", "world"),
+ "listInts" to listOf(1, 42),
+ "listEnums" to bindingVersion.listEnums,
+ "listIntSpecial" to bindingVersion.listIntSpecial,
+ ),
+ )
+
+ when (bindingVersion) {
+ V1 -> {
+ // when
+ action as ActionWithAllTypesOfInputsBindingV1
+ @Suppress("DATA_CLASS_INVISIBLE_COPY_USAGE_WARNING")
+ val actionWithOneChange = action.copy(fooBar = "another")
+
+ // then
+ actionWithOneChange.fooBar shouldBe "another"
+ }
+
+ V2 -> {
+ // when
+ action as ActionWithAllTypesOfInputsBindingV2
+ @Suppress("DATA_CLASS_INVISIBLE_COPY_USAGE_WARNING")
+ val actionWithOneChange = action.copy(fooBar = "another")
+
+ // then
+ actionWithOneChange.fooBar shouldBe "another"
+ }
+ }
+ }
}
+})
- it("works for custom values") {
- // given
- val action = ActionWithAllTypesOfInputs(
- fooBar = "test",
- bazGoo = true,
- binKin = false,
- intPint = 43,
- floPint = 123.456f,
- finBin = ActionWithAllTypesOfInputs.Bin.Custom("this-is-custom!"),
- gooZen = ActionWithAllTypesOfInputs.Zen.Value(123),
- bahEnum = ActionWithAllTypesOfInputs.BahEnum.Custom("very-custom"),
- )
+private val BindingVersion.finBin
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Bin.BooBar
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Bin.BooBar
+ }
- // when
- val yaml = action.toYamlArguments()
-
- // then
- yaml shouldBe linkedMapOf(
- "foo-bar" to "test",
- "baz-goo" to "true",
- "bin-kin" to "false",
- "int-pint" to "43",
- "flo-pint" to "123.456",
- "fin-bin" to "this-is-custom!",
- "goo-zen" to "123",
- "bah-enum" to "very-custom",
- )
+private val BindingVersion.customFinBin
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Bin.Custom("this-is-custom!")
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Bin.Custom("this-is-custom!")
}
- it("untyped input is sufficient for required input") {
- // given
- val action = ActionWithAllTypesOfInputs(
- fooBar = "test",
- bazGoo_Untyped = "\${{ 1 == 1 }}",
- binKin = false,
- intPint = 43,
- floPint = 123.456f,
- finBin = ActionWithAllTypesOfInputs.Bin.Custom("this-is-custom!"),
- gooZen = ActionWithAllTypesOfInputs.Zen.Value(123),
- bahEnum = ActionWithAllTypesOfInputs.BahEnum.Custom("very-custom"),
- )
+private val BindingVersion.gooZen
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Zen.Special1
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Zen.Special1
+ }
- // when
- val yaml = action.toYamlArguments()
-
- // then
- yaml shouldBe linkedMapOf(
- "foo-bar" to "test",
- "baz-goo" to "\${{ 1 == 1 }}",
- "bin-kin" to "false",
- "int-pint" to "43",
- "flo-pint" to "123.456",
- "fin-bin" to "this-is-custom!",
- "goo-zen" to "123",
- "bah-enum" to "very-custom",
- )
+private val BindingVersion.customGooZen
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Zen.Value(123)
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Zen.Value(123)
}
- it("validates required inputs are not missing") {
- // expect
- val exception =
- shouldThrow {
- ActionWithAllTypesOfInputs()
- }
- exception.message shouldBe "Either fooBar or fooBar_Untyped must be set, one of them is required"
+private val BindingVersion.bahEnum
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.BahEnum.HelloWorld
+ V2 -> ActionWithAllTypesOfInputsBindingV2.BahEnum.HelloWorld
}
- it("validates required inputs are not supplied typed and untyped") {
- // expect
- val exception =
- shouldThrow {
- ActionWithAllTypesOfInputs(
- fooBar = "test",
- fooBar_Untyped = "untyped test",
- )
- }
- exception.message shouldBe "Only fooBar or fooBar_Untyped must be set, but not both"
+private val BindingVersion.customBahEnum
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.BahEnum.Custom("very-custom")
+ V2 -> ActionWithAllTypesOfInputsBindingV2.BahEnum.Custom("very-custom")
}
- it("validates not-required inputs are not supplied typed and untyped") {
- // expect
- val exception =
- shouldThrow {
- ActionWithAllTypesOfInputs(
- fooBar = "test",
- bazGoo_Untyped = "\${{ 1 == 1 }}",
- binKin = false,
- intPint = 43,
- floPint = 123.456f,
- finBin = ActionWithAllTypesOfInputs.Bin.Custom("this-is-custom!"),
- gooZen = ActionWithAllTypesOfInputs.Zen.Value(123),
- bahEnum = ActionWithAllTypesOfInputs.BahEnum.Custom("very-custom"),
- listStrings = listOf("test"),
- listStrings_Untyped = "untyped test",
- )
- }
- exception.message shouldBe "Only listStrings or listStrings_Untyped must be set, but not both"
+private val BindingVersion.listEnums
+ get() = when (this) {
+ V1 -> listOf(ActionWithAllTypesOfInputsBindingV1.MyEnum.One, ActionWithAllTypesOfInputsBindingV1.MyEnum.Three)
+ V2 -> listOf(ActionWithAllTypesOfInputsBindingV2.MyEnum.One, ActionWithAllTypesOfInputsBindingV2.MyEnum.Three)
}
- it("exposes copy method") {
- // given
- val action = ActionWithAllTypesOfInputs(
- fooBar = "test",
- bazGoo = true,
- binKin = false,
- intPint = 43,
- floPint = 123.456f,
- finBin = ActionWithAllTypesOfInputs.Bin.BooBar,
- gooZen = ActionWithAllTypesOfInputs.Zen.Special1,
- bahEnum = ActionWithAllTypesOfInputs.BahEnum.HelloWorld,
- listStrings = listOf("hello", "world"),
- listInts = listOf(1, 42),
- listEnums = listOf(ActionWithAllTypesOfInputs.MyEnum.One, ActionWithAllTypesOfInputs.MyEnum.Three),
- listIntSpecial = listOf(ActionWithAllTypesOfInputs.MyInt.TheAnswer, ActionWithAllTypesOfInputs.MyInt.Value(0))
+private val BindingVersion.listIntSpecial
+ get() = when (this) {
+ V1 -> listOf(
+ ActionWithAllTypesOfInputsBindingV1.MyInt.TheAnswer,
+ ActionWithAllTypesOfInputsBindingV1.MyInt.Value(0),
)
- // when
- @Suppress("DATA_CLASS_INVISIBLE_COPY_USAGE_WARNING")
- val actionWithOneChange = action.copy(fooBar = "another")
-
- // then
- actionWithOneChange.fooBar shouldBe "another"
+ V2 -> listOf(
+ ActionWithAllTypesOfInputsBindingV2.MyInt.TheAnswer,
+ ActionWithAllTypesOfInputsBindingV2.MyInt.Value(0),
+ )
}
-})
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithComment.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithCommentV1.kt
similarity index 96%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithComment.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithCommentV1.kt
index 00cbd5cb33..e434fe6a56 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithComment.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithCommentV1.kt
@@ -24,7 +24,7 @@ import kotlin.collections.toTypedArray
*
* Do something cool
*
- * [Action on GitHub](https://github.com/john-smith/action-with-comment)
+ * [Action on GitHub](https://github.com/john-smith/action-with-comment-v1)
*
* @param foo <required> Short description
* @param foo_Untyped <required> Short description
@@ -32,7 +32,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithComment private constructor(
+public data class ActionWithCommentV1 private constructor(
/**
* <required> Short description
*/
@@ -49,7 +49,7 @@ public data class ActionWithComment private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-comment", _customVersion ?: "v3", "some-comment") {
+) : RegularAction("john-smith", "action-with-comment-v1", _customVersion ?: "v3", "some-comment") {
init {
require(!((foo != null) && (foo_Untyped != null))) {
"Only foo or foo_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithCommentV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithCommentV2.kt
new file mode 100644
index 0000000000..ddb0885d33
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithCommentV2.kt
@@ -0,0 +1,88 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Action with comment
+ *
+ * Do something cool
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-comment-v2)
+ *
+ * @param foo <required> Short description
+ * @param foo_Untyped <required> Short description
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithCommentV2 private constructor(
+ /**
+ * <required> Short description
+ */
+ public val foo: String? = null,
+ /**
+ * <required> Short description
+ */
+ public val foo_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-comment-v2", _customVersion ?: "v3", "some-comment") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-comment-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-comment-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((foo != null) && (foo_Untyped != null))) {
+ "Only foo or foo_Untyped must be set, but not both"
+ }
+ require((foo != null) || (foo_Untyped != null)) {
+ "Either foo or foo_Untyped must be set, one of them is required"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ foo: String? = null,
+ foo_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(foo = foo, foo_Untyped = foo_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ foo?.let { "foo" to it },
+ foo_Untyped?.let { "foo" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClashBindingV1.kt
similarity index 93%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClashBindingV1.kt
index 2bbb75c954..011f5495d1 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClash.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClashBindingV1.kt
@@ -24,7 +24,7 @@ import kotlin.collections.toTypedArray
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-deprecated-input-and-name-clash)
+ * [Action on GitHub](https://github.com/john-smith/action-with-deprecated-input-and-name-clash-binding-v1)
*
* @param fooBar <required> Foo bar - new
* @param fooBar_Untyped <required> Foo bar - new
@@ -32,7 +32,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithDeprecatedInputAndNameClash private constructor(
+public data class ActionWithDeprecatedInputAndNameClashBindingV1 private constructor(
/**
* <required> Foo bar - new
*/
@@ -49,7 +49,7 @@ public data class ActionWithDeprecatedInputAndNameClash private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-deprecated-input-and-name-clash", _customVersion ?: "v2") {
+) : RegularAction("john-smith", "action-with-deprecated-input-and-name-clash-binding-v1", _customVersion ?: "v2") {
init {
require(!((fooBar != null) && (fooBar_Untyped != null))) {
"Only fooBar or fooBar_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClashBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClashBindingV2.kt
new file mode 100644
index 0000000000..2c14723448
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithDeprecatedInputAndNameClashBindingV2.kt
@@ -0,0 +1,88 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Some Action
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-deprecated-input-and-name-clash-binding-v2)
+ *
+ * @param fooBar <required> Foo bar - new
+ * @param fooBar_Untyped <required> Foo bar - new
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithDeprecatedInputAndNameClashBindingV2 private constructor(
+ /**
+ * <required> Foo bar - new
+ */
+ public val fooBar: String? = null,
+ /**
+ * <required> Foo bar - new
+ */
+ public val fooBar_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-deprecated-input-and-name-clash-binding-v2", _customVersion ?: "v2") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-deprecated-input-and-name-clash-binding-v2@v2 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-deprecated-input-and-name-clash-binding-v2@v2 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((fooBar != null) && (fooBar_Untyped != null))) {
+ "Only fooBar or fooBar_Untyped must be set, but not both"
+ }
+ require((fooBar != null) || (fooBar_Untyped != null)) {
+ "Either fooBar or fooBar_Untyped must be set, one of them is required"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooBar: String? = null,
+ fooBar_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooBar = fooBar, fooBar_Untyped = fooBar_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ fooBar?.let { "fooBar" to it },
+ fooBar_Untyped?.let { "fooBar" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocsBindingV1.kt
similarity index 95%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocsBindingV1.kt
index 5467de3e5e..2269ee2f66 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocs.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocsBindingV1.kt
@@ -24,7 +24,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-fancy-chars-in-docs)
+ * [Action on GitHub](https://github.com/john-smith/action-with-fancy-chars-in-docs-binding-v1)
*
* @param nestedKotlinComments This is a /* test */
* @param nestedKotlinComments_Untyped This is a /* test */
@@ -34,7 +34,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithFancyCharsInDocs private constructor(
+public data class ActionWithFancyCharsInDocsBindingV1 private constructor(
/**
* This is a /* test */
*/
@@ -59,7 +59,7 @@ public data class ActionWithFancyCharsInDocs private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-fancy-chars-in-docs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-fancy-chars-in-docs-binding-v1", _customVersion ?: "v3") {
init {
require(!((nestedKotlinComments != null) && (nestedKotlinComments_Untyped != null))) {
"Only nestedKotlinComments or nestedKotlinComments_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocsBindingV2.kt
new file mode 100644
index 0000000000..55329df926
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithFancyCharsInDocsBindingV2.kt
@@ -0,0 +1,103 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-fancy-chars-in-docs-binding-v2)
+ *
+ * @param nestedKotlinComments This is a /* test */
+ * @param nestedKotlinComments_Untyped This is a /* test */
+ * @param percent For example "100%"
+ * @param percent_Untyped For example "100%"
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithFancyCharsInDocsBindingV2 private constructor(
+ /**
+ * This is a /* test */
+ */
+ public val nestedKotlinComments: String? = null,
+ /**
+ * This is a /* test */
+ */
+ public val nestedKotlinComments_Untyped: String? = null,
+ /**
+ * For example "100%"
+ */
+ public val percent: String? = null,
+ /**
+ * For example "100%"
+ */
+ public val percent_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-fancy-chars-in-docs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-fancy-chars-in-docs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-fancy-chars-in-docs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((nestedKotlinComments != null) && (nestedKotlinComments_Untyped != null))) {
+ "Only nestedKotlinComments or nestedKotlinComments_Untyped must be set, but not both"
+ }
+
+ require(!((percent != null) && (percent_Untyped != null))) {
+ "Only percent or percent_Untyped must be set, but not both"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ nestedKotlinComments: String? = null,
+ nestedKotlinComments_Untyped: String? = null,
+ percent: String? = null,
+ percent_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(nestedKotlinComments = nestedKotlinComments, nestedKotlinComments_Untyped = nestedKotlinComments_Untyped, percent = percent, percent_Untyped = percent_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ nestedKotlinComments?.let { "nested-kotlin-comments" to it },
+ nestedKotlinComments_Untyped?.let { "nested-kotlin-comments" to it },
+ percent?.let { "percent" to it },
+ percent_Untyped?.let { "percent" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingTypeBindingV1.kt
similarity index 85%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingTypeBindingV1.kt
index f3ced46bb8..a706fb9cf2 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingType.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingTypeBindingV1.kt
@@ -25,7 +25,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-inputs-sharing-type)
+ * [Action on GitHub](https://github.com/john-smith/action-with-inputs-sharing-type-binding-v1)
*
* @param fooOne <required>
* @param fooOne_Untyped <required>
@@ -35,11 +35,11 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithInputsSharingType private constructor(
+public data class ActionWithInputsSharingTypeBindingV1 private constructor(
/**
* <required>
*/
- public val fooOne: ActionWithInputsSharingType.Foo? = null,
+ public val fooOne: ActionWithInputsSharingTypeBindingV1.Foo? = null,
/**
* <required>
*/
@@ -47,12 +47,12 @@ public data class ActionWithInputsSharingType private constructor(
/**
* <required>
*/
- public val fooTwo: ActionWithInputsSharingType.Foo? = null,
+ public val fooTwo: ActionWithInputsSharingTypeBindingV1.Foo? = null,
/**
* <required>
*/
public val fooTwo_Untyped: String? = null,
- public val fooThree: ActionWithInputsSharingType.Foo? = null,
+ public val fooThree: ActionWithInputsSharingTypeBindingV1.Foo? = null,
public val fooThree_Untyped: String? = null,
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
@@ -62,7 +62,7 @@ public data class ActionWithInputsSharingType private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-inputs-sharing-type", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-inputs-sharing-type-binding-v1", _customVersion ?: "v3") {
init {
require(!((fooOne != null) && (fooOne_Untyped != null))) {
"Only fooOne or fooOne_Untyped must be set, but not both"
@@ -85,11 +85,11 @@ public data class ActionWithInputsSharingType private constructor(
public constructor(
vararg pleaseUseNamedArguments: Unit,
- fooOne: ActionWithInputsSharingType.Foo? = null,
+ fooOne: ActionWithInputsSharingTypeBindingV1.Foo? = null,
fooOne_Untyped: String? = null,
- fooTwo: ActionWithInputsSharingType.Foo? = null,
+ fooTwo: ActionWithInputsSharingTypeBindingV1.Foo? = null,
fooTwo_Untyped: String? = null,
- fooThree: ActionWithInputsSharingType.Foo? = null,
+ fooThree: ActionWithInputsSharingTypeBindingV1.Foo? = null,
fooThree_Untyped: String? = null,
_customInputs: Map = mapOf(),
_customVersion: String? = null,
@@ -115,8 +115,8 @@ public data class ActionWithInputsSharingType private constructor(
) {
public class Value(
requestedValue: Int,
- ) : ActionWithInputsSharingType.Foo(requestedValue)
+ ) : ActionWithInputsSharingTypeBindingV1.Foo(requestedValue)
- public object Special1 : ActionWithInputsSharingType.Foo(3)
+ public object Special1 : ActionWithInputsSharingTypeBindingV1.Foo(3)
}
}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingTypeBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingTypeBindingV2.kt
new file mode 100644
index 0000000000..026e146b24
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithInputsSharingTypeBindingV2.kt
@@ -0,0 +1,130 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.Int
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-inputs-sharing-type-binding-v2)
+ *
+ * @param fooOne <required>
+ * @param fooOne_Untyped <required>
+ * @param fooTwo <required>
+ * @param fooTwo_Untyped <required>
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithInputsSharingTypeBindingV2 private constructor(
+ /**
+ * <required>
+ */
+ public val fooOne: ActionWithInputsSharingTypeBindingV2.Foo? = null,
+ /**
+ * <required>
+ */
+ public val fooOne_Untyped: String? = null,
+ /**
+ * <required>
+ */
+ public val fooTwo: ActionWithInputsSharingTypeBindingV2.Foo? = null,
+ /**
+ * <required>
+ */
+ public val fooTwo_Untyped: String? = null,
+ public val fooThree: ActionWithInputsSharingTypeBindingV2.Foo? = null,
+ public val fooThree_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-inputs-sharing-type-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-inputs-sharing-type-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-inputs-sharing-type-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((fooOne != null) && (fooOne_Untyped != null))) {
+ "Only fooOne or fooOne_Untyped must be set, but not both"
+ }
+ require((fooOne != null) || (fooOne_Untyped != null)) {
+ "Either fooOne or fooOne_Untyped must be set, one of them is required"
+ }
+
+ require(!((fooTwo != null) && (fooTwo_Untyped != null))) {
+ "Only fooTwo or fooTwo_Untyped must be set, but not both"
+ }
+ require((fooTwo != null) || (fooTwo_Untyped != null)) {
+ "Either fooTwo or fooTwo_Untyped must be set, one of them is required"
+ }
+
+ require(!((fooThree != null) && (fooThree_Untyped != null))) {
+ "Only fooThree or fooThree_Untyped must be set, but not both"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooOne: ActionWithInputsSharingTypeBindingV2.Foo? = null,
+ fooOne_Untyped: String? = null,
+ fooTwo: ActionWithInputsSharingTypeBindingV2.Foo? = null,
+ fooTwo_Untyped: String? = null,
+ fooThree: ActionWithInputsSharingTypeBindingV2.Foo? = null,
+ fooThree_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooOne = fooOne, fooOne_Untyped = fooOne_Untyped, fooTwo = fooTwo, fooTwo_Untyped = fooTwo_Untyped, fooThree = fooThree, fooThree_Untyped = fooThree_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ fooOne?.let { "foo-one" to it.integerValue.toString() },
+ fooOne_Untyped?.let { "foo-one" to it },
+ fooTwo?.let { "foo-two" to it.integerValue.toString() },
+ fooTwo_Untyped?.let { "foo-two" to it },
+ fooThree?.let { "foo-three" to it.integerValue.toString() },
+ fooThree_Untyped?.let { "foo-three" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+
+ public sealed class Foo(
+ public val integerValue: Int,
+ ) {
+ public class Value(
+ requestedValue: Int,
+ ) : ActionWithInputsSharingTypeBindingV2.Foo(requestedValue)
+
+ public object Special1 : ActionWithInputsSharingTypeBindingV2.Foo(3)
+ }
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsBindingV1.kt
similarity index 93%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputs.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsBindingV1.kt
index 082a73ed0e..e8f87647fb 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputs.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsBindingV1.kt
@@ -22,13 +22,13 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-binding-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithNoInputs private constructor(
+public data class ActionWithNoInputsBindingV1 private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -37,7 +37,7 @@ public data class ActionWithNoInputs private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-inputs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-no-inputs-binding-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsBindingV2.kt
new file mode 100644
index 0000000000..b20f199d0c
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsBindingV2.kt
@@ -0,0 +1,62 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * Action: Action With No Inputs
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-binding-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithNoInputsBindingV2 private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-inputs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-inputs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-inputs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersion.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersionV1.kt
similarity index 94%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersion.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersionV1.kt
index 23c5d0593c..bc335027a8 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersion.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersionV1.kt
@@ -23,14 +23,14 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-from-fallback-version)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-from-fallback-version-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@Deprecated("This typed binding was created from typings for an older version in https://github.com/typesafegithub/github-actions-typing-catalog. As soon as typings for the requested version are added, there could be breaking changes, and you need to delete these typings from your local Maven cache typically found in ~/.m2/repository/ to get the updated typing. In some cases, though, you may be lucky and things will work fine. To be on the safe side, consider contributing updated typings to the catalog before using this version, or even better: ask the action's owner to host the typings together with the action using https://github.com/typesafegithub/github-actions-typing.")
@ExposedCopyVisibility
-public data class ActionWithNoInputsFromFallbackVersion private constructor(
+public data class ActionWithNoInputsFromFallbackVersionV1 private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -39,7 +39,7 @@ public data class ActionWithNoInputsFromFallbackVersion private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-inputs-from-fallback-version", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-no-inputs-from-fallback-version-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersionV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersionV2.kt
new file mode 100644
index 0000000000..a42c56e834
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsFromFallbackVersionV2.kt
@@ -0,0 +1,64 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Deprecated
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * Action: Action With No Inputs From Fallback Version
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-from-fallback-version-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@Deprecated("This typed binding was created from typings for an older version in https://github.com/typesafegithub/github-actions-typing-catalog. As soon as typings for the requested version are added, there could be breaking changes, and you need to delete these typings from your local Maven cache typically found in ~/.m2/repository/ to get the updated typing. In some cases, though, you may be lucky and things will work fine. To be on the safe side, consider contributing updated typings to the catalog before using this version, or even better: ask the action's owner to host the typings together with the action using https://github.com/typesafegithub/github-actions-typing.")
+@ExposedCopyVisibility
+public data class ActionWithNoInputsFromFallbackVersionV2 private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-inputs-from-fallback-version-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-inputs-from-fallback-version-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-inputs-from-fallback-version-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersion.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV1.kt
similarity index 92%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersion.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV1.kt
index 816ada8366..c4a7914f2e 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersion.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV1.kt
@@ -22,13 +22,13 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-major-version)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-major-version-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithNoInputsWithMajorVersion private constructor(
+public data class ActionWithNoInputsWithMajorVersionV1 private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -37,7 +37,7 @@ public data class ActionWithNoInputsWithMajorVersion private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-inputs-with-major-version", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-no-inputs-with-major-version-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersion_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV1_Untyped.kt
similarity index 93%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersion_Untyped.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV1_Untyped.kt
index c25b6ab78f..e397f9b33f 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersion_Untyped.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV1_Untyped.kt
@@ -43,17 +43,17 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-minor-version)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-major-version-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
"Use the typed class instead",
- ReplaceWith("ActionWithNoInputsWithMinorVersion"),
+ ReplaceWith("ActionWithNoInputsWithMajorVersionV1"),
)
@ExposedCopyVisibility
-public data class ActionWithNoInputsWithMinorVersion_Untyped private constructor(
+public data class ActionWithNoInputsWithMajorVersionV1_Untyped private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -62,7 +62,7 @@ public data class ActionWithNoInputsWithMinorVersion_Untyped private constructor
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-inputs-with-minor-version", _customVersion ?: "v3.1") {
+) : RegularAction("john-smith", "action-with-no-inputs-with-major-version-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV2.kt
new file mode 100644
index 0000000000..2fede49fcd
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV2.kt
@@ -0,0 +1,62 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * Action: Action With No Inputs
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-major-version-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithNoInputsWithMajorVersionV2 private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-inputs-with-major-version-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-inputs-with-major-version-v2 with major version@v3.1.3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-inputs-with-major-version-v2 with major version@v3.1.3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV2_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV2_Untyped.kt
new file mode 100644
index 0000000000..98ae9d6759
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersionV2_Untyped.kt
@@ -0,0 +1,87 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Deprecated
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * ```text
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!! WARNING !!!
+ * !!! !!!
+ * !!! This action binding has no typings provided. All inputs will !!!
+ * !!! have a default type of String. !!!
+ * !!! To be able to use this action in a type-safe way, ask the !!!
+ * !!! action's owner to provide the typings using !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing !!!
+ * !!! !!!
+ * !!! or if it's impossible, contribute typings to a community-driven !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing-catalog !!!
+ * !!! !!!
+ * !!! This '_Untyped' binding will be available even once the typings !!!
+ * !!! are added. !!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ```
+ *
+ * Action: Action With No Inputs
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-major-version-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@Deprecated(
+ "Use the typed class instead",
+ ReplaceWith("ActionWithNoInputsWithMajorVersionV2"),
+)
+@ExposedCopyVisibility
+public data class ActionWithNoInputsWithMajorVersionV2_Untyped private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-inputs-with-major-version-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-inputs-with-major-version-v2 with major version@v3.1.3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-inputs-with-major-version-v2 with major version@v3.1.3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersion.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV1.kt
similarity index 92%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersion.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV1.kt
index 4d993f162b..1eff9b381b 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersion.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV1.kt
@@ -22,13 +22,13 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-minor-version)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-minor-version-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithNoInputsWithMinorVersion private constructor(
+public data class ActionWithNoInputsWithMinorVersionV1 private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -37,7 +37,7 @@ public data class ActionWithNoInputsWithMinorVersion private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-inputs-with-minor-version", _customVersion ?: "v3.1") {
+) : RegularAction("john-smith", "action-with-no-inputs-with-minor-version-v1", _customVersion ?: "v3.1") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersion_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV1_Untyped.kt
similarity index 93%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersion_Untyped.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV1_Untyped.kt
index be8da8adfa..f01fce2559 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMajorVersion_Untyped.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV1_Untyped.kt
@@ -43,17 +43,17 @@ import kotlin.collections.Map
*
* Description
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-major-version)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-minor-version-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
"Use the typed class instead",
- ReplaceWith("ActionWithNoInputsWithMajorVersion"),
+ ReplaceWith("ActionWithNoInputsWithMinorVersionV1"),
)
@ExposedCopyVisibility
-public data class ActionWithNoInputsWithMajorVersion_Untyped private constructor(
+public data class ActionWithNoInputsWithMinorVersionV1_Untyped private constructor(
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
@@ -62,7 +62,7 @@ public data class ActionWithNoInputsWithMajorVersion_Untyped private constructor
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-inputs-with-major-version", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-no-inputs-with-minor-version-v1", _customVersion ?: "v3.1") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
_customInputs: Map = mapOf(),
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV2.kt
new file mode 100644
index 0000000000..dede726cd4
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV2.kt
@@ -0,0 +1,62 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * Action: Action With No Inputs
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-minor-version-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithNoInputsWithMinorVersionV2 private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-inputs-with-minor-version-v2", _customVersion ?: "v3.1") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-inputs-with-minor-version-v2 with minor version@v3.1.3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-inputs-with-minor-version-v2 with minor version@v3.1.3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV2_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV2_Untyped.kt
new file mode 100644
index 0000000000..5cbfe3c11e
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoInputsWithMinorVersionV2_Untyped.kt
@@ -0,0 +1,87 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Deprecated
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+
+/**
+ * ```text
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!! WARNING !!!
+ * !!! !!!
+ * !!! This action binding has no typings provided. All inputs will !!!
+ * !!! have a default type of String. !!!
+ * !!! To be able to use this action in a type-safe way, ask the !!!
+ * !!! action's owner to provide the typings using !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing !!!
+ * !!! !!!
+ * !!! or if it's impossible, contribute typings to a community-driven !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing-catalog !!!
+ * !!! !!!
+ * !!! This '_Untyped' binding will be available even once the typings !!!
+ * !!! are added. !!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ```
+ *
+ * Action: Action With No Inputs
+ *
+ * Description
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-inputs-with-minor-version-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@Deprecated(
+ "Use the typed class instead",
+ ReplaceWith("ActionWithNoInputsWithMinorVersionV2"),
+)
+@ExposedCopyVisibility
+public data class ActionWithNoInputsWithMinorVersionV2_Untyped private constructor(
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-inputs-with-minor-version-v2", _customVersion ?: "v3.1") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-inputs-with-minor-version-v2 with minor version@v3.1.3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-inputs-with-minor-version-v2 with minor version@v3.1.3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(_customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = LinkedHashMap(_customInputs)
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypingsBindingV1_Untyped.kt
similarity index 96%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypingsBindingV1_Untyped.kt
index f4138edbdc..b11ec65352 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypings_Untyped.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypingsBindingV1_Untyped.kt
@@ -44,13 +44,13 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-no-typings)
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-typings-binding-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithNoTypings_Untyped private constructor(
+public data class ActionWithNoTypingsBindingV1_Untyped private constructor(
public val foo_Untyped: String,
public val bar_Untyped: String? = null,
/**
@@ -61,7 +61,7 @@ public data class ActionWithNoTypings_Untyped private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-no-typings", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-no-typings-binding-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
foo_Untyped: String,
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypingsBindingV2_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypingsBindingV2_Untyped.kt
new file mode 100644
index 0000000000..97db7e9c94
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithNoTypingsBindingV2_Untyped.kt
@@ -0,0 +1,94 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * ```text
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!! WARNING !!!
+ * !!! !!!
+ * !!! This action binding has no typings provided. All inputs will !!!
+ * !!! have a default type of String. !!!
+ * !!! To be able to use this action in a type-safe way, ask the !!!
+ * !!! action's owner to provide the typings using !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing !!!
+ * !!! !!!
+ * !!! or if it's impossible, contribute typings to a community-driven !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing-catalog !!!
+ * !!! !!!
+ * !!! This '_Untyped' binding will be available even once the typings !!!
+ * !!! are added. !!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ```
+ *
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-no-typings-binding-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithNoTypingsBindingV2_Untyped private constructor(
+ public val foo_Untyped: String,
+ public val bar_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-no-typings-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-no-typings-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-no-typings-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ foo_Untyped: String,
+ bar_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(foo_Untyped = foo_Untyped, bar_Untyped = bar_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ "foo" to foo_Untyped,
+ bar_Untyped?.let { "bar" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsBindingV1.kt
similarity index 94%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsBindingV1.kt
index b9553d7f0e..0dd782e010 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputs.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsBindingV1.kt
@@ -24,7 +24,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-outputs)
+ * [Action on GitHub](https://github.com/john-smith/action-with-outputs-binding-v1)
*
* @param fooBar <required> Short description
* @param fooBar_Untyped <required> Short description
@@ -32,7 +32,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithOutputs private constructor(
+public data class ActionWithOutputsBindingV1 private constructor(
/**
* <required> Short description
*/
@@ -49,7 +49,7 @@ public data class ActionWithOutputs private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-outputs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-outputs-binding-v1", _customVersion ?: "v3") {
init {
require(!((fooBar != null) && (fooBar_Untyped != null))) {
"Only fooBar or fooBar_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsBindingV2.kt
new file mode 100644
index 0000000000..41d06e17f7
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsBindingV2.kt
@@ -0,0 +1,102 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-outputs-binding-v2)
+ *
+ * @param fooBar <required> Short description
+ * @param fooBar_Untyped <required> Short description
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithOutputsBindingV2 private constructor(
+ /**
+ * <required> Short description
+ */
+ public val fooBar: String? = null,
+ /**
+ * <required> Short description
+ */
+ public val fooBar_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-outputs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-outputs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-outputs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((fooBar != null) && (fooBar_Untyped != null))) {
+ "Only fooBar or fooBar_Untyped must be set, but not both"
+ }
+ require((fooBar != null) || (fooBar_Untyped != null)) {
+ "Either fooBar or fooBar_Untyped must be set, one of them is required"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooBar: String? = null,
+ fooBar_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooBar = fooBar, fooBar_Untyped = fooBar_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ fooBar?.let { "foo-bar" to it },
+ fooBar_Untyped?.let { "foo-bar" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
+
+ public class Outputs(
+ stepId: String,
+ ) : Action.Outputs(stepId) {
+ /**
+ * Cool output!
+ */
+ public val bazGoo: String = "steps.$stepId.outputs.baz-goo"
+
+ /**
+ * Another output...
+ */
+ public val looWoz: String = "steps.$stepId.outputs.loo-woz"
+ }
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsTest.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsTest.kt
index 780b36f6af..b2869d0b39 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsTest.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithOutputsTest.kt
@@ -1,17 +1,40 @@
package io.github.typesafegithub.workflows.actionbindinggenerator.bindingsfromunittests
-import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithOutputs
+import io.github.typesafegithub.workflows.actionbindinggenerator.constructAction
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion.V1
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion.V2
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithOutputsBindingV1
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithOutputsBindingV2
+import io.github.typesafegithub.workflows.testutils.withAllBindingVersions
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
class ActionWithOutputsTest : DescribeSpec({
- it("fields have correct output placeholders") {
- // given
- val outputs = ActionWithOutputs(fooBar = "1").buildOutputObject("someStepId")
+ withAllBindingVersions { bindingVersion ->
+ it("fields have correct output placeholders") {
+ // given
+ val outputs = constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithOutputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf("fooBar" to "1"),
+ ).buildOutputObject("someStepId")
- // when & then
- outputs.bazGoo shouldBe "steps.someStepId.outputs.baz-goo"
- outputs.looWoz shouldBe "steps.someStepId.outputs.loo-woz"
- outputs["custom-output"] shouldBe "steps.someStepId.outputs.custom-output"
+ // when & then
+ when (bindingVersion) {
+ V1 -> {
+ outputs as ActionWithOutputsBindingV1.Outputs
+ outputs.bazGoo shouldBe "steps.someStepId.outputs.baz-goo"
+ outputs.looWoz shouldBe "steps.someStepId.outputs.loo-woz"
+ }
+
+ V2 -> {
+ outputs as ActionWithOutputsBindingV2.Outputs
+ outputs.bazGoo shouldBe "steps.someStepId.outputs.baz-goo"
+ outputs.looWoz shouldBe "steps.someStepId.outputs.loo-woz"
+ }
+ }
+ outputs["custom-output"] shouldBe "steps.someStepId.outputs.custom-output"
+ }
}
})
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypings.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV1.kt
similarity index 95%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypings.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV1.kt
index 4e0a43853a..002287e0ef 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypings.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV1.kt
@@ -25,7 +25,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-partly-typings)
+ * [Action on GitHub](https://github.com/john-smith/action-with-partly-typings-binding-v1)
*
* @param foo <required>
* @param foo_Untyped <required>
@@ -33,7 +33,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithPartlyTypings private constructor(
+public data class ActionWithPartlyTypingsBindingV1 private constructor(
/**
* <required>
*/
@@ -52,7 +52,7 @@ public data class ActionWithPartlyTypings private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-partly-typings", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-partly-typings-binding-v1", _customVersion ?: "v3") {
init {
require(!((foo != null) && (foo_Untyped != null))) {
"Only foo or foo_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypings_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV1_Untyped.kt
similarity index 95%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypings_Untyped.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV1_Untyped.kt
index 9c24d01d19..ef67992a98 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypings_Untyped.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV1_Untyped.kt
@@ -45,17 +45,17 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-partly-typings)
+ * [Action on GitHub](https://github.com/john-smith/action-with-partly-typings-binding-v1)
*
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
"Use the typed class instead",
- ReplaceWith("ActionWithPartlyTypings"),
+ ReplaceWith("ActionWithPartlyTypingsBindingV1"),
)
@ExposedCopyVisibility
-public data class ActionWithPartlyTypings_Untyped private constructor(
+public data class ActionWithPartlyTypingsBindingV1_Untyped private constructor(
public val foo_Untyped: String,
public val bar_Untyped: String? = null,
public val baz_Untyped: String,
@@ -67,7 +67,7 @@ public data class ActionWithPartlyTypings_Untyped private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-partly-typings", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-partly-typings-binding-v1", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
foo_Untyped: String,
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV2.kt
new file mode 100644
index 0000000000..317a813b5a
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV2.kt
@@ -0,0 +1,95 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.Int
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-partly-typings-binding-v2)
+ *
+ * @param foo <required>
+ * @param foo_Untyped <required>
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithPartlyTypingsBindingV2 private constructor(
+ /**
+ * <required>
+ */
+ public val foo: Int? = null,
+ /**
+ * <required>
+ */
+ public val foo_Untyped: String? = null,
+ public val bar_Untyped: String? = null,
+ public val baz_Untyped: String,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-partly-typings-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-partly-typings-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-partly-typings-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((foo != null) && (foo_Untyped != null))) {
+ "Only foo or foo_Untyped must be set, but not both"
+ }
+ require((foo != null) || (foo_Untyped != null)) {
+ "Either foo or foo_Untyped must be set, one of them is required"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ foo: Int? = null,
+ foo_Untyped: String? = null,
+ bar_Untyped: String? = null,
+ baz_Untyped: String,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(foo = foo, foo_Untyped = foo_Untyped, bar_Untyped = bar_Untyped, baz_Untyped = baz_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ foo?.let { "foo" to it.toString() },
+ foo_Untyped?.let { "foo" to it },
+ bar_Untyped?.let { "bar" to it },
+ "baz" to baz_Untyped,
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV2_Untyped.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV2_Untyped.kt
new file mode 100644
index 0000000000..8d2d2d786c
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithPartlyTypingsBindingV2_Untyped.kt
@@ -0,0 +1,102 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Deprecated
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * ```text
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * !!! WARNING !!!
+ * !!! !!!
+ * !!! This action binding has no typings provided. All inputs will !!!
+ * !!! have a default type of String. !!!
+ * !!! To be able to use this action in a type-safe way, ask the !!!
+ * !!! action's owner to provide the typings using !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing !!!
+ * !!! !!!
+ * !!! or if it's impossible, contribute typings to a community-driven !!!
+ * !!! !!!
+ * !!! https://github.com/typesafegithub/github-actions-typing-catalog !!!
+ * !!! !!!
+ * !!! This '_Untyped' binding will be available even once the typings !!!
+ * !!! are added. !!!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * ```
+ *
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-partly-typings-binding-v2)
+ *
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@Deprecated(
+ "Use the typed class instead",
+ ReplaceWith("ActionWithPartlyTypingsBindingV2"),
+)
+@ExposedCopyVisibility
+public data class ActionWithPartlyTypingsBindingV2_Untyped private constructor(
+ public val foo_Untyped: String,
+ public val bar_Untyped: String? = null,
+ public val baz_Untyped: String,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-partly-typings-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-partly-typings-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-partly-typings-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ foo_Untyped: String,
+ bar_Untyped: String? = null,
+ baz_Untyped: String,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(foo_Untyped = foo_Untyped, bar_Untyped = bar_Untyped, baz_Untyped = baz_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ "foo" to foo_Untyped,
+ bar_Untyped?.let { "bar" to it },
+ "baz" to baz_Untyped,
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsBindingV1.kt
similarity index 97%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsBindingV1.kt
index 1e06670cfd..941cc320e5 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputs.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsBindingV1.kt
@@ -24,7 +24,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/action-with-some-optional-inputs)
+ * [Action on GitHub](https://github.com/john-smith/action-with-some-optional-inputs-binding-v1)
*
* @param fooBar Required is default, default is set
* @param fooBar_Untyped Required is default, default is set
@@ -40,7 +40,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class ActionWithSomeOptionalInputs private constructor(
+public data class ActionWithSomeOptionalInputsBindingV1 private constructor(
/**
* Required is default, default is set
*/
@@ -89,7 +89,7 @@ public data class ActionWithSomeOptionalInputs private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "action-with-some-optional-inputs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "action-with-some-optional-inputs-binding-v1", _customVersion ?: "v3") {
init {
require(!((fooBar != null) && (fooBar_Untyped != null))) {
"Only fooBar or fooBar_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsBindingV2.kt
new file mode 100644
index 0000000000..1ae94320d1
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsBindingV2.kt
@@ -0,0 +1,160 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/action-with-some-optional-inputs-binding-v2)
+ *
+ * @param fooBar Required is default, default is set
+ * @param fooBar_Untyped Required is default, default is set
+ * @param bazGoo Required is default, default is null
+ * @param bazGoo_Untyped Required is default, default is null
+ * @param zooDar Required is false, default is set
+ * @param zooDar_Untyped Required is false, default is set
+ * @param cooPoo Required is false, default is default
+ * @param cooPoo_Untyped Required is false, default is default
+ * @param package <required> Required is true, default is default
+ * @param package_Untyped <required> Required is true, default is default
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class ActionWithSomeOptionalInputsBindingV2 private constructor(
+ /**
+ * Required is default, default is set
+ */
+ public val fooBar: String? = null,
+ /**
+ * Required is default, default is set
+ */
+ public val fooBar_Untyped: String? = null,
+ /**
+ * Required is default, default is null
+ */
+ public val bazGoo: String? = null,
+ /**
+ * Required is default, default is null
+ */
+ public val bazGoo_Untyped: String? = null,
+ /**
+ * Required is false, default is set
+ */
+ public val zooDar: String? = null,
+ /**
+ * Required is false, default is set
+ */
+ public val zooDar_Untyped: String? = null,
+ /**
+ * Required is false, default is default
+ */
+ public val cooPoo: String? = null,
+ /**
+ * Required is false, default is default
+ */
+ public val cooPoo_Untyped: String? = null,
+ /**
+ * <required> Required is true, default is default
+ */
+ public val `package`: String? = null,
+ /**
+ * <required> Required is true, default is default
+ */
+ public val package_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "action-with-some-optional-inputs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/action-with-some-optional-inputs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/action-with-some-optional-inputs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((fooBar != null) && (fooBar_Untyped != null))) {
+ "Only fooBar or fooBar_Untyped must be set, but not both"
+ }
+
+ require(!((bazGoo != null) && (bazGoo_Untyped != null))) {
+ "Only bazGoo or bazGoo_Untyped must be set, but not both"
+ }
+
+ require(!((zooDar != null) && (zooDar_Untyped != null))) {
+ "Only zooDar or zooDar_Untyped must be set, but not both"
+ }
+
+ require(!((cooPoo != null) && (cooPoo_Untyped != null))) {
+ "Only cooPoo or cooPoo_Untyped must be set, but not both"
+ }
+
+ require(!((`package` != null) && (package_Untyped != null))) {
+ "Only package or package_Untyped must be set, but not both"
+ }
+ require((`package` != null) || (package_Untyped != null)) {
+ "Either package or package_Untyped must be set, one of them is required"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooBar: String? = null,
+ fooBar_Untyped: String? = null,
+ bazGoo: String? = null,
+ bazGoo_Untyped: String? = null,
+ zooDar: String? = null,
+ zooDar_Untyped: String? = null,
+ cooPoo: String? = null,
+ cooPoo_Untyped: String? = null,
+ `package`: String? = null,
+ package_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooBar = fooBar, fooBar_Untyped = fooBar_Untyped, bazGoo = bazGoo, bazGoo_Untyped = bazGoo_Untyped, zooDar = zooDar, zooDar_Untyped = zooDar_Untyped, cooPoo = cooPoo, cooPoo_Untyped = cooPoo_Untyped, `package` = `package`, package_Untyped = package_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ fooBar?.let { "foo-bar" to it },
+ fooBar_Untyped?.let { "foo-bar" to it },
+ bazGoo?.let { "baz-goo" to it },
+ bazGoo_Untyped?.let { "baz-goo" to it },
+ zooDar?.let { "zoo-dar" to it },
+ zooDar_Untyped?.let { "zoo-dar" to it },
+ cooPoo?.let { "coo-poo" to it },
+ cooPoo_Untyped?.let { "coo-poo" to it },
+ `package`?.let { "package" to it },
+ package_Untyped?.let { "package" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsTest.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsTest.kt
index eeafee18be..9a595e0e07 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsTest.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSomeOptionalInputsTest.kt
@@ -1,24 +1,32 @@
package io.github.typesafegithub.workflows.actionbindinggenerator.bindingsfromunittests
-import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithSomeOptionalInputs
+import io.github.typesafegithub.workflows.actionbindinggenerator.constructAction
+import io.github.typesafegithub.workflows.testutils.withAllBindingVersions
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
class ActionWithSomeOptionalInputsTest : DescribeSpec({
- it("renders with defaults") {
- // given
- val action = ActionWithSomeOptionalInputs(
- bazGoo = "def456",
- `package` = "qwe789"
- )
+ withAllBindingVersions { bindingVersion ->
+ it("renders with defaults") {
+ // given
+ val action = constructAction(
+ owner = "johnsmith",
+ classBaseName = "ActionWithSomeOptionalInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "bazGoo" to "def456",
+ "package" to "qwe789",
+ ),
+ )
- // when
- val yaml = action.toYamlArguments()
+ // when
+ val yaml = action.toYamlArguments()
- // then
- yaml shouldBe linkedMapOf(
- "baz-goo" to "def456",
- "package" to "qwe789",
- )
+ // then
+ yaml shouldBe linkedMapOf(
+ "baz-goo" to "def456",
+ "package" to "qwe789",
+ )
+ }
}
})
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsBindingV1.kt
similarity index 95%
rename from action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt
rename to action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsBindingV1.kt
index 54aeca42e1..2ab89083c1 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputs.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsBindingV1.kt
@@ -27,7 +27,7 @@ import kotlin.collections.toTypedArray
*
* This is a test description that should be put in the KDoc comment for a class
*
- * [Action on GitHub](https://github.com/john-smith/simple-action-with-required-string-inputs)
+ * [Action on GitHub](https://github.com/john-smith/simple-action-with-required-string-inputs-binding-v1)
*
* @param fooBar <required> Short description
* @param fooBar_Untyped <required> Short description
@@ -39,7 +39,7 @@ import kotlin.collections.toTypedArray
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
@ExposedCopyVisibility
-public data class SimpleActionWithRequiredStringInputs private constructor(
+public data class SimpleActionWithRequiredStringInputsBindingV1 private constructor(
/**
* <required> Short description
*/
@@ -68,7 +68,7 @@ public data class SimpleActionWithRequiredStringInputs private constructor(
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
-) : RegularAction("john-smith", "simple-action-with-required-string-inputs", _customVersion ?: "v3") {
+) : RegularAction("john-smith", "simple-action-with-required-string-inputs-binding-v1", _customVersion ?: "v3") {
init {
require(!((fooBar != null) && (fooBar_Untyped != null))) {
"Only fooBar or fooBar_Untyped must be set, but not both"
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsBindingV2.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsBindingV2.kt
new file mode 100644
index 0000000000..efbb2c7e5a
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsBindingV2.kt
@@ -0,0 +1,118 @@
+// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
+// changes will be overwritten with the next binding code regeneration.
+// See https://github.com/typesafegithub/github-workflows-kt for more info.
+@file:Suppress(
+ "DataClassPrivateConstructor",
+ "UNUSED_PARAMETER",
+ "DEPRECATION",
+)
+
+package io.github.typesafegithub.workflows.actions.johnsmith
+
+import io.github.typesafegithub.workflows.domain.actions.Action
+import io.github.typesafegithub.workflows.domain.actions.RegularAction
+import java.util.LinkedHashMap
+import kotlin.Deprecated
+import kotlin.ExposedCopyVisibility
+import kotlin.String
+import kotlin.Suppress
+import kotlin.Unit
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Do something cool
+ * and describe it in multiple lines
+ *
+ * This is a test description that should be put in the KDoc comment for a class
+ *
+ * [Action on GitHub](https://github.com/john-smith/simple-action-with-required-string-inputs-binding-v2)
+ *
+ * @param fooBar <required> Short description
+ * @param fooBar_Untyped <required> Short description
+ * @param bazGoo <required> Just another input
+ * with multiline description
+ * @param bazGoo_Untyped <required> Just another input
+ * with multiline description
+ * @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ * @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+@ExposedCopyVisibility
+public data class SimpleActionWithRequiredStringInputsBindingV2 private constructor(
+ /**
+ * <required> Short description
+ */
+ public val fooBar: String? = null,
+ /**
+ * <required> Short description
+ */
+ public val fooBar_Untyped: String? = null,
+ /**
+ * <required> Just another input
+ * with multiline description
+ */
+ @Deprecated("this is deprecated")
+ public val bazGoo: String? = null,
+ /**
+ * <required> Just another input
+ * with multiline description
+ */
+ @Deprecated("this is deprecated")
+ public val bazGoo_Untyped: String? = null,
+ /**
+ * Type-unsafe map where you can put any inputs that are not yet supported by the binding
+ */
+ public val _customInputs: Map = mapOf(),
+ /**
+ * Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about
+ */
+ public val _customVersion: String? = null,
+) : RegularAction("john-smith", "simple-action-with-required-string-inputs-binding-v2", _customVersion ?: "v3") {
+ init {
+ println("WARNING: The used binding version v2 for john-smith/simple-action-with-required-string-inputs-binding-v2@v3 is experimental! Last stable version is v1.")
+ if (System.getenv("GITHUB_ACTIONS").toBoolean()) {
+ println("""
+ |
+ |::warning title=Experimental Binding Version Used::The used binding version v2 for john-smith/simple-action-with-required-string-inputs-binding-v2@v3 is experimental! Last stable version is v1.
+ """.trimMargin())
+ }
+
+ require(!((fooBar != null) && (fooBar_Untyped != null))) {
+ "Only fooBar or fooBar_Untyped must be set, but not both"
+ }
+ require((fooBar != null) || (fooBar_Untyped != null)) {
+ "Either fooBar or fooBar_Untyped must be set, one of them is required"
+ }
+
+ require(!((bazGoo != null) && (bazGoo_Untyped != null))) {
+ "Only bazGoo or bazGoo_Untyped must be set, but not both"
+ }
+ require((bazGoo != null) || (bazGoo_Untyped != null)) {
+ "Either bazGoo or bazGoo_Untyped must be set, one of them is required"
+ }
+ }
+
+ public constructor(
+ vararg pleaseUseNamedArguments: Unit,
+ fooBar: String? = null,
+ fooBar_Untyped: String? = null,
+ bazGoo: String? = null,
+ bazGoo_Untyped: String? = null,
+ _customInputs: Map = mapOf(),
+ _customVersion: String? = null,
+ ) : this(fooBar = fooBar, fooBar_Untyped = fooBar_Untyped, bazGoo = bazGoo, bazGoo_Untyped = bazGoo_Untyped, _customInputs = _customInputs, _customVersion = _customVersion)
+
+ @Suppress("SpreadOperator")
+ override fun toYamlArguments(): LinkedHashMap = linkedMapOf(
+ *listOfNotNull(
+ fooBar?.let { "foo-bar" to it },
+ fooBar_Untyped?.let { "foo-bar" to it },
+ bazGoo?.let { "baz-goo" to it },
+ bazGoo_Untyped?.let { "baz-goo" to it },
+ *_customInputs.toList().toTypedArray(),
+ ).toTypedArray()
+ )
+
+ override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
+}
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsTest.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsTest.kt
index 598972405c..66cf68c40d 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsTest.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/SimpleActionWithRequiredStringInputsTest.kt
@@ -1,24 +1,32 @@
package io.github.typesafegithub.workflows.actionbindinggenerator.bindingsfromunittests
-import io.github.typesafegithub.workflows.actions.johnsmith.SimpleActionWithRequiredStringInputs
+import io.github.typesafegithub.workflows.actionbindinggenerator.constructAction
+import io.github.typesafegithub.workflows.testutils.withAllBindingVersions
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.shouldBe
class SimpleActionWithRequiredStringInputsTest : DescribeSpec({
- it("renders with defaults") {
- // given
- val action = SimpleActionWithRequiredStringInputs(
- fooBar = "abc123",
- bazGoo = "def456",
- )
+ withAllBindingVersions { bindingVersion ->
+ it("renders with defaults") {
+ // given
+ val action = constructAction(
+ owner = "johnsmith",
+ classBaseName = "SimpleActionWithRequiredStringInputs",
+ bindingVersion = bindingVersion,
+ arguments = mapOf(
+ "fooBar" to "abc123",
+ "bazGoo" to "def456",
+ ),
+ )
- // when
- val yaml = action.toYamlArguments()
+ // when
+ val yaml = action.toYamlArguments()
- // then
- yaml shouldBe linkedMapOf(
- "foo-bar" to "abc123",
- "baz-goo" to "def456",
- )
+ // then
+ yaml shouldBe linkedMapOf(
+ "foo-bar" to "abc123",
+ "baz-goo" to "def456",
+ )
+ }
}
})
diff --git a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationTest.kt b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationTest.kt
index cfb5b56c3e..2ae9652277 100644
--- a/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationTest.kt
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/GenerationTest.kt
@@ -20,6 +20,7 @@ import io.github.typesafegithub.workflows.actionbindinggenerator.typing.IntegerW
import io.github.typesafegithub.workflows.actionbindinggenerator.typing.ListOfTypings
import io.github.typesafegithub.workflows.actionbindinggenerator.typing.StringTyping
import io.github.typesafegithub.workflows.actionbindinggenerator.typing.Typing
+import io.github.typesafegithub.workflows.testutils.withAllBindingVersions
import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.collections.shouldHaveSize
@@ -114,503 +115,602 @@ class GenerationTest :
),
)
- test("action with required inputs as strings, no outputs") {
- // given
- val actionManifest =
- Metadata(
- name =
- """
- Do something cool
- and describe it in multiple lines
- """.trimIndent(),
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "foo-bar" to
- Input(
- description = "Short description",
- required = true,
- default = null,
- ),
- "baz-goo" to
- Input(
- description =
- """
- Just another input
- with multiline description
- """.trimIndent(),
- deprecationMessage = "this is deprecated",
- required = true,
- default = null,
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "simple-action-with-required-string-inputs", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = actionManifest.allInputsAsStrings(), source = ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("SimpleActionWithRequiredStringInputs.kt")
- }
-
- test("action with various combinations of input parameters describing being required or optional") {
- // given
- val actionManifest =
- Metadata(
- name = "Do something cool",
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "foo-bar" to
- Input(
- description = "Required is default, default is set",
- default = "barfoo",
- ),
- "baz-goo" to
- Input(
- description = "Required is default, default is null",
- default = null,
- ),
- "zoo-dar" to
- Input(
- description = "Required is false, default is set",
- required = false,
- default = "googoo",
- ),
- "coo-poo" to
- Input(
- description = "Required is false, default is default",
- required = false,
- ),
- "package" to
- Input(
- description = "Required is true, default is default",
- required = true,
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-some-optional-inputs", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = actionManifest.allInputsAsStrings(), source = ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithSomeOptionalInputs.kt")
- }
-
- test("action with all types of inputs") {
- // given
- val coords = ActionCoords("john-smith", "action-with-all-types-of-inputs", "v3")
+ withAllBindingVersions { bindingVersion ->
+ test("action with required inputs as strings, no outputs") {
+ // given
+ val actionManifest =
+ Metadata(
+ name =
+ """
+ Do something cool
+ and describe it in multiple lines
+ """.trimIndent(),
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "foo-bar" to
+ Input(
+ description = "Short description",
+ required = true,
+ default = null,
+ ),
+ "baz-goo" to
+ Input(
+ description =
+ """
+ Just another input
+ with multiline description
+ """.trimIndent(),
+ deprecationMessage = "this is deprecated",
+ required = true,
+ default = null,
+ ),
+ ),
+ )
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "simple-action-with-required-string-inputs-binding-$bindingVersion",
+ "v3",
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = actionManifest.allInputsAsStrings(),
+ source = ACTION,
+ ),
+ )
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifestWithAllTypesOfInputsAndSomeOutput,
- inputTypings = ActionTypings(inputTypings = typingsForAllTypesOfInputs, source = ACTION),
+ // then
+ binding.shouldContainAndMatchFile(
+ "SimpleActionWithRequiredStringInputsBinding${bindingVersion.name}.kt",
)
-
- // then
- assertSoftly {
- binding.shouldContainAndMatchFile("ActionWithAllTypesOfInputs.kt")
- binding.shouldContainAndMatchFile("ActionWithAllTypesOfInputs_Untyped.kt")
}
- }
-
- test("action with outputs") {
- // given
- val actionManifest =
- Metadata(
- name = "Do something cool",
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "foo-bar" to
- Input(
- description = "Short description",
- required = true,
- default = null,
- ),
- ),
- outputs =
- mapOf(
- "baz-goo" to Output(description = "Cool output!"),
- "loo-woz" to Output(description = "Another output..."),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-outputs", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = actionManifest.allInputsAsStrings(), source = ACTION),
- )
- // then
- binding.shouldContainAndMatchFile("ActionWithOutputs.kt")
- }
-
- test("action with no inputs") {
- // given
- val actionManifestHasNoInputs = emptyMap()
- val actionManifest =
- Metadata(
- inputs = actionManifestHasNoInputs,
- name = "Action With No Inputs",
- description = "Description",
- )
-
- val coords = ActionCoords("john-smith", "action-with-no-inputs", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithNoInputs.kt")
- }
-
- test("action with no inputs from fallback version") {
- // given
- val actionManifestHasNoInputs = emptyMap()
- val actionManifest =
- Metadata(
- inputs = actionManifestHasNoInputs,
- name = "Action With No Inputs From Fallback Version",
- description = "Description",
- )
-
- val coords = ActionCoords("john-smith", "action-with-no-inputs-from-fallback-version", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(source = TYPING_CATALOG, fromFallbackVersion = true),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithNoInputsFromFallbackVersion.kt")
- }
-
- test("subaction") {
- // given
- val actionManifestHasNoInputs = emptyMap()
- val actionManifest =
- Metadata(
- inputs = actionManifestHasNoInputs,
- name = "Action With No Inputs",
- description = "Description",
- )
-
- val coords = ActionCoords("john-smith", "action-with", "v3", FULL, "sub/action")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithSubAction.kt")
- }
+ test("action with various combinations of input parameters describing being required or optional") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Do something cool",
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "foo-bar" to
+ Input(
+ description = "Required is default, default is set",
+ default = "barfoo",
+ ),
+ "baz-goo" to
+ Input(
+ description = "Required is default, default is null",
+ default = null,
+ ),
+ "zoo-dar" to
+ Input(
+ description = "Required is false, default is set",
+ required = false,
+ default = "googoo",
+ ),
+ "coo-poo" to
+ Input(
+ description = "Required is false, default is default",
+ required = false,
+ ),
+ "package" to
+ Input(
+ description = "Required is true, default is default",
+ required = true,
+ ),
+ ),
+ )
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "action-with-some-optional-inputs-binding-$bindingVersion",
+ "v3",
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = actionManifest.allInputsAsStrings(),
+ source = ACTION,
+ ),
+ )
- test("action with deprecated input resolving to the same Kotlin field name") {
- // given
- val actionManifest =
- Metadata(
- inputs =
- mapOf(
- "foo-bar" to
- Input(
- description = "Foo bar - old",
- required = true,
- default = null,
- deprecationMessage = "Use 'fooBar'!",
- ),
- "fooBar" to
- Input(
- description = "Foo bar - new",
- required = true,
- default = null,
- ),
- ),
- name = "Some Action",
- description = "Description",
- )
+ // then
+ binding.shouldContainAndMatchFile("ActionWithSomeOptionalInputsBinding${bindingVersion.name}.kt")
+ }
- val coords = ActionCoords("john-smith", "action-with-deprecated-input-and-name-clash", "v2")
+ test("action with all types of inputs") {
+ // given
+ val coords = ActionCoords("john-smith", "action-with-all-types-of-inputs-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifestWithAllTypesOfInputsAndSomeOutput,
+ inputTypings = ActionTypings(inputTypings = typingsForAllTypesOfInputs, source = ACTION),
+ )
+
+ // then
+ assertSoftly {
+ binding.shouldContainAndMatchFile(
+ "ActionWithAllTypesOfInputsBinding${bindingVersion.name}.kt",
+ )
+ binding.shouldContainAndMatchFile(
+ "ActionWithAllTypesOfInputsBinding${bindingVersion.name}_Untyped.kt",
+ )
+ }
+ }
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = actionManifest.allInputsAsStrings(), source = ACTION),
- )
+ test("action with outputs") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Do something cool",
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "foo-bar" to
+ Input(
+ description = "Short description",
+ required = true,
+ default = null,
+ ),
+ ),
+ outputs =
+ mapOf(
+ "baz-goo" to Output(description = "Cool output!"),
+ "loo-woz" to Output(description = "Another output..."),
+ ),
+ )
+ val coords = ActionCoords("john-smith", "action-with-outputs-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = actionManifest.allInputsAsStrings(),
+ source = ACTION,
+ ),
+ )
- // then
- binding.shouldContainAndMatchFile("ActionWithDeprecatedInputAndNameClash.kt")
- }
+ // then
+ binding.shouldContainAndMatchFile("ActionWithOutputsBinding${bindingVersion.name}.kt")
+ }
- test("action with inputs sharing type") {
- // given
- val actionManifest =
- Metadata(
- name = "Do something cool",
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "foo-one" to
- Input(
- required = true,
- default = null,
- ),
- "foo-two" to
- Input(
- required = true,
- default = null,
- ),
- "foo-three" to
- Input(
- required = false,
- default = "test",
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-inputs-sharing-type", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings =
- ActionTypings(
- inputTypings =
- mapOf(
- "foo-one" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
- "foo-two" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
- "foo-three" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
- ),
- source = ACTION,
- ),
- )
+ test("action with no inputs") {
+ // given
+ val actionManifestHasNoInputs = emptyMap()
+ val actionManifest =
+ Metadata(
+ inputs = actionManifestHasNoInputs,
+ name = "Action With No Inputs",
+ description = "Description",
+ )
+
+ val coords = ActionCoords("john-smith", "action-with-no-inputs-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithNoInputsBinding${bindingVersion.name}.kt")
+ }
- // then
- binding.shouldContainAndMatchFile("ActionWithInputsSharingType.kt")
- }
+ test("action with no inputs from fallback version") {
+ // given
+ val actionManifestHasNoInputs = emptyMap()
+ val actionManifest =
+ Metadata(
+ inputs = actionManifestHasNoInputs,
+ name = "Action With No Inputs From Fallback Version",
+ description = "Description",
+ )
+
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "action-with-no-inputs-from-fallback-version-$bindingVersion",
+ "v3",
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = ActionTypings(source = TYPING_CATALOG, fromFallbackVersion = true),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithNoInputsFromFallbackVersion${bindingVersion.name}.kt")
+ }
- test("action with input descriptions with fancy characters") {
- // given
- val actionManifest =
- Metadata(
- name = "Do something cool",
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "nested-kotlin-comments" to
- Input(
- description = "This is a /* test */",
- ),
- "percent" to
- Input(
- description = "For example \"100%\"",
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-fancy-chars-in-docs", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = actionManifest.allInputsAsStrings(), source = ACTION),
- )
+ test("subaction") {
+ // given
+ val actionManifestHasNoInputs = emptyMap()
+ val actionManifest =
+ Metadata(
+ inputs = actionManifestHasNoInputs,
+ name = "Action With No Inputs",
+ description = "Description",
+ )
+
+ val coords = ActionCoords("john-smith", "action-binding-$bindingVersion-with", "v3", FULL, "sub/action")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionBinding${bindingVersion.name}WithSubAction.kt")
+ }
- // then
- binding.shouldContainAndMatchFile("ActionWithFancyCharsInDocs.kt")
- }
+ test("action with deprecated input resolving to the same Kotlin field name") {
+ // given
+ val actionManifest =
+ Metadata(
+ inputs =
+ mapOf(
+ "foo-bar" to
+ Input(
+ description = "Foo bar - old",
+ required = true,
+ default = null,
+ deprecationMessage = "Use 'fooBar'!",
+ ),
+ "fooBar" to
+ Input(
+ description = "Foo bar - new",
+ required = true,
+ default = null,
+ ),
+ ),
+ name = "Some Action",
+ description = "Description",
+ )
+
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "action-with-deprecated-input-and-name-clash-binding-$bindingVersion",
+ "v2",
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = actionManifest.allInputsAsStrings(),
+ source = ACTION,
+ ),
+ )
- test("action with no typings has only an untyped binding") {
- // given
- val actionManifest =
- Metadata(
- name = "Do something cool",
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "foo" to
- Input(
- required = true,
- default = null,
- ),
- "bar" to
- Input(
- required = false,
- default = "test",
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-no-typings", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = emptyMap(), source = null),
+ // then
+ binding.shouldContainAndMatchFile(
+ "ActionWithDeprecatedInputAndNameClashBinding${bindingVersion.name}.kt",
)
+ }
- // then
- binding shouldHaveSize 1
- binding.shouldContainAndMatchFile("ActionWithNoTypings_Untyped.kt")
- }
-
- test("action with partly typings has only untyped properties for the non-typed inputs") {
- // given
- val actionManifest =
- Metadata(
- name = "Do something cool",
- description = "This is a test description that should be put in the KDoc comment for a class",
- inputs =
- mapOf(
- "foo" to
- Input(
- required = true,
- default = null,
- ),
- "bar" to
- Input(
- required = false,
- default = "test",
- ),
- "baz" to
- Input(
- required = true,
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-partly-typings", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = mapOf("foo" to IntegerTyping), source = TYPING_CATALOG),
- )
+ test("action with inputs sharing type") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Do something cool",
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "foo-one" to
+ Input(
+ required = true,
+ default = null,
+ ),
+ "foo-two" to
+ Input(
+ required = true,
+ default = null,
+ ),
+ "foo-three" to
+ Input(
+ required = false,
+ default = "test",
+ ),
+ ),
+ )
+ val coords = ActionCoords("john-smith", "action-with-inputs-sharing-type-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings =
+ mapOf(
+ "foo-one" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
+ "foo-two" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
+ "foo-three" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
+ ),
+ source = ACTION,
+ ),
+ )
- // then
- assertSoftly {
- binding.shouldContainAndMatchFile("ActionWithPartlyTypings.kt")
- binding.shouldContainAndMatchFile("ActionWithPartlyTypings_Untyped.kt")
+ // then
+ binding.shouldContainAndMatchFile("ActionWithInputsSharingTypeBinding${bindingVersion.name}.kt")
}
- }
-
- test("action with no inputs with major version") {
- // given
- val actionManifestHasNoInputs = emptyMap()
- val actionManifest =
- Metadata(
- inputs = actionManifestHasNoInputs,
- name = "Action With No Inputs",
- description = "Description",
- )
- val coords = ActionCoords("john-smith", "action-with-no-inputs-with-major-version", "v3.1.3", MAJOR)
+ test("action with input descriptions with fancy characters") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Do something cool",
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "nested-kotlin-comments" to
+ Input(
+ description = "This is a /* test */",
+ ),
+ "percent" to
+ Input(
+ description = "For example \"100%\"",
+ ),
+ ),
+ )
+ val coords = ActionCoords("john-smith", "action-with-fancy-chars-in-docs-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = actionManifest.allInputsAsStrings(),
+ source = ACTION,
+ ),
+ )
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
- )
+ // then
+ binding.shouldContainAndMatchFile("ActionWithFancyCharsInDocsBinding${bindingVersion.name}.kt")
+ }
- // then
- assertSoftly {
- binding.shouldContainAndMatchFile("ActionWithNoInputsWithMajorVersion.kt")
- binding.shouldContainAndMatchFile("ActionWithNoInputsWithMajorVersion_Untyped.kt")
+ test("action with no typings has only an untyped binding") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Do something cool",
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "foo" to
+ Input(
+ required = true,
+ default = null,
+ ),
+ "bar" to
+ Input(
+ required = false,
+ default = "test",
+ ),
+ ),
+ )
+ val coords = ActionCoords("john-smith", "action-with-no-typings-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = ActionTypings(inputTypings = emptyMap(), source = null),
+ )
+
+ // then
+ binding shouldHaveSize 1
+ binding.shouldContainAndMatchFile("ActionWithNoTypingsBinding${bindingVersion.name}_Untyped.kt")
}
- }
- test("action with no inputs with minor version") {
- // given
- val actionManifestHasNoInputs = emptyMap()
- val actionManifest =
- Metadata(
- inputs = actionManifestHasNoInputs,
- name = "Action With No Inputs",
- description = "Description",
- )
+ test("action with partly typings has only untyped properties for the non-typed inputs") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Do something cool",
+ description = "This is a test description that should be put in the KDoc comment for a class",
+ inputs =
+ mapOf(
+ "foo" to
+ Input(
+ required = true,
+ default = null,
+ ),
+ "bar" to
+ Input(
+ required = false,
+ default = "test",
+ ),
+ "baz" to
+ Input(
+ required = true,
+ ),
+ ),
+ )
+ val coords = ActionCoords("john-smith", "action-with-partly-typings-binding-$bindingVersion", "v3")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = mapOf("foo" to IntegerTyping),
+ source = TYPING_CATALOG,
+ ),
+ )
- val coords = ActionCoords("john-smith", "action-with-no-inputs-with-minor-version", "v3.1.3", MINOR)
+ // then
+ assertSoftly {
+ binding.shouldContainAndMatchFile("ActionWithPartlyTypingsBinding${bindingVersion.name}.kt")
+ binding.shouldContainAndMatchFile("ActionWithPartlyTypingsBinding${bindingVersion.name}_Untyped.kt")
+ }
+ }
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
- )
+ test("action with no inputs with major version") {
+ // given
+ val actionManifestHasNoInputs = emptyMap()
+ val actionManifest =
+ Metadata(
+ inputs = actionManifestHasNoInputs,
+ name = "Action With No Inputs",
+ description = "Description",
+ )
+
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "action-with-no-inputs-with-major-version-$bindingVersion",
+ "v3.1.3",
+ MAJOR,
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
+ )
+
+ // then
+ assertSoftly {
+ binding.shouldContainAndMatchFile(
+ "ActionWithNoInputsWithMajorVersion${bindingVersion.name}.kt",
+ )
+ binding.shouldContainAndMatchFile(
+ "ActionWithNoInputsWithMajorVersion${bindingVersion.name}_Untyped.kt",
+ )
+ }
+ }
- // then
- assertSoftly {
- binding.shouldContainAndMatchFile("ActionWithNoInputsWithMinorVersion.kt")
- binding.shouldContainAndMatchFile("ActionWithNoInputsWithMinorVersion_Untyped.kt")
+ test("action with no inputs with minor version") {
+ // given
+ val actionManifestHasNoInputs = emptyMap()
+ val actionManifest =
+ Metadata(
+ inputs = actionManifestHasNoInputs,
+ name = "Action With No Inputs",
+ description = "Description",
+ )
+
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "action-with-no-inputs-with-minor-version-$bindingVersion",
+ "v3.1.3",
+ MINOR,
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = ActionTypings(inputTypings = emptyMap(), source = ACTION),
+ )
+
+ // then
+ assertSoftly {
+ binding.shouldContainAndMatchFile(
+ "ActionWithNoInputsWithMinorVersion${bindingVersion.name}.kt",
+ )
+ binding.shouldContainAndMatchFile(
+ "ActionWithNoInputsWithMinorVersion${bindingVersion.name}_Untyped.kt",
+ )
+ }
}
- }
- test("action with comment") {
- // given
- val actionManifest =
- Metadata(
- name = "Action with comment",
- description = "Do something cool",
- inputs =
- mapOf(
- "foo" to
- Input(
- description = "Short description",
- required = true,
- default = null,
- ),
- ),
- )
- val coords = ActionCoords("john-smith", "action-with-comment", "v3", comment = "some-comment")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = ActionTypings(inputTypings = actionManifest.allInputsAsStrings(), source = ACTION),
- )
+ test("action with comment") {
+ // given
+ val actionManifest =
+ Metadata(
+ name = "Action with comment",
+ description = "Do something cool",
+ inputs =
+ mapOf(
+ "foo" to
+ Input(
+ description = "Short description",
+ required = true,
+ default = null,
+ ),
+ ),
+ )
+ val coords =
+ ActionCoords(
+ "john-smith",
+ "action-with-comment-$bindingVersion",
+ "v3",
+ comment = "some-comment",
+ )
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings =
+ ActionTypings(
+ inputTypings = actionManifest.allInputsAsStrings(),
+ source = ACTION,
+ ),
+ )
- // then
- binding.shouldContainAndMatchFile("ActionWithComment.kt")
+ // then
+ binding.shouldContainAndMatchFile("ActionWithComment${bindingVersion.name}.kt")
+ }
}
})
diff --git a/docs/user-guide/using-actions.md b/docs/user-guide/using-actions.md
index f88ea7208b..94945360a2 100644
--- a/docs/user-guide/using-actions.md
+++ b/docs/user-guide/using-actions.md
@@ -85,6 +85,88 @@ as it could still make sense to use them, for example if you want to set the val
This approach supports dependency updating bots that support Kotlin Script's `.main.kts` files. E.g. Renovate is known
to support it.
+### Binary compatibility of generated bindings
+
+The generated bindings are not guaranteed to be binary compatible. As soon as an action owner for example adds a
+new input, the signature of the constructor changes and the signature of the `copy` method of that action's binding
+changes. So you should not use these generated bindings in any pre-compiled code, unless you are pretty sure you
+know what you are doing and are aware of the consequences.
+
+The typical usage of the generated bindings are not affected by this. By technically enforcing the usage of named
+arguments when using the constructor or `copy` method, the bindings stay source compatible even if new inputs are
+added. So if you are just using the bindings within `.main.kts` scripts for which they are designed, you are safe.
+The only exception is, when an action owner removes or renames an input. But according to semver, this is a breaking
+change and an action author should not do this within the same major version. If he nevertheless did, open a bug
+issue in that action's GitHub repository so the owner can revert the change and instead release a new major version.
+
+### Available binding versions
+
+Evolving this library and / or the generated bindings sometimes requires breaking changes in the generated bindings.
+To not break your existing workflow scripts, the bindings have an additional binding version as an optional prefix
+to the actual action version and without changing the binding version, the generated actions should always stay
+backwards compatible (in terms of source compatibility). The version `v3` of an action within binding version `v2` is
+requested with the version `binding_version_v2___v3`. If accidentally a breaking change was done within one binding
+version, please open a bug report. Unless very good reasons object, the change will be reverted and instead be done in
+a new binding version. Such a situation is usually indicated by your workflow scripts suddenly failing to execute
+without you having done any changes to it, except if the breaking change is caused by an action author doing a breaking
+change inappropriately. In that case, please open a bug report with that action's GitHub repository instead.
+
+#### Stability statuses
+
+*Experimental*
+
+: If a new binding version is added, it will initially be in experimental state. When using such a binding version,
+ you get the cutting edge changes, but no stability is guaranteed. Any breaking change can happen at any time, so
+ use these bindings only if you have that in mind and consent to the consequences. Executing a workflow script with
+ such a binding version will issue a warning and executing it on GitHub Actions will add a warning annotation to the
+ workflow run.
+
+*Stable*
+
+: Binding versions that are in stable state will not have any source incompatible changes done. There will typically
+ only be one stable binding version, and that is what you should usually use in your workflow scripts.
+
+*Deprecated*
+
+: Upon new stable binding version becoming available, existing stable binding version will most probably be moved to
+ deprecated state. Deprecated state for now does not mean, that the binding version will become unavailable. In a
+ deprecated binding version also no source incompatible changes will be done, but new changes might not be added to
+ the deprecated binding version. The main intention of deprecating a binding version is to hint at a newer stable
+ binding version being available. For this all bindings generated in that binding version will be marked as
+ `@Deprecated` and executing the workflow script will issue a warning and if run on GitHub Actions will add
+ a warning annotation to the workflow run.
+
+| Binding Version | Stability |
+|-------------------------------------|-----------------------------------------------------------------------|
+| `` | :material-check-bold:{ style="color: green" } stable (alias for `v1`) |
+| `v1` | :material-check-bold:{ style="color: green" } stable |
+| `v2` | :no_entry: experimental |
+
+#### Library version compatibility
+
+As the library and / or generated bindings evolve, not all library versions will be compatible with all binding
+versions. This table lists which library versions are compatible with which binding version.
+
+| Binding Version | Compatibility |
+|-----------------|-------------------|
+| `v1` | `3.0.0` and newer |
+| `v2` | `3.0.0` and newer |
+
+#### Breaking changes
+
+This section shows which source incompatible breaking changes were done in each binding version. When changing
+from a previous binding version to a later one, these might be issues you are hitting and need to adapt to in
+your workflow scripts. Binary breaking changes are not listed here, as binary compatibility is not guaranteed
+anyway as defined above.
+
+`v2`
+
+: TBD
+
+`v1`
+
+: This is the original `v1` binding version with which generated bindings have started.
+
## User-defined actions
If you are in a hurry and adding typings is not possible right now, browse these options.
diff --git a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt
index 8824b8825a..0f4112d52b 100644
--- a/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt
+++ b/jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsing.kt
@@ -75,11 +75,21 @@ private fun Parameters.parseVersion(
else -> {
val bindingVersionPart = bindingVersionAndVersionParts[0].substringAfter("binding_version_")
- BindingVersion
- .entries
- .find {
- it.name.lowercase() == bindingVersionPart
- } to bindingVersionAndVersionParts[1]
+ val bindingVersion =
+ BindingVersion
+ .entries
+ .find {
+ it.name.lowercase() == bindingVersionPart
+ }
+ if ((bindingVersion?.isExperimental == true) &&
+ !bindingVersionAndVersionParts[1].endsWith("-beta")
+ ) {
+ null to bindingVersionAndVersionParts[1]
+ } else if (bindingVersion?.isExperimental == true) {
+ bindingVersion to bindingVersionAndVersionParts[1].removeSuffix("-beta")
+ } else {
+ bindingVersion to bindingVersionAndVersionParts[1]
+ }
}
}
val (version, comment) =
diff --git a/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt b/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt
index 983ffe6dbe..937ce04633 100644
--- a/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt
+++ b/jit-binding-server/src/test/kotlin/io/github/typesafegithub/workflows/jitbindingserver/RequestParsingTest.kt
@@ -19,27 +19,40 @@ class RequestParsingTest :
FunSpec(
{
withContexts(
- nameFn = { """version prefix "${it.second}"""" },
+ nameFn = { """version prefix "${it.second}", version suffix "${it.third}"""" },
ts =
sequence {
- yield(V1 to "")
- BindingVersion.entries.forEach { yield(it to "binding_version_${it}___") }
+ yield(Triple(V1, "", ""))
+ BindingVersion.entries.forEach {
+ yield(
+ Triple(
+ it,
+ "binding_version_${it}___",
+ if (it.isExperimental) "-beta" else "",
+ ),
+ )
+ }
yield(
- null to "binding_version_v${
- BindingVersion
- .entries
- .last()
- .name
- .substringAfter('V')
- .toInt() + 1
- }___",
+ Triple(
+ null,
+ "binding_version_v${
+ BindingVersion
+ .entries
+ .last()
+ .name
+ .substringAfter('V')
+ .toInt() + 1
+ }___",
+ "",
+ ),
)
- yield(null to "binding-version_v1___")
+ yield(Triple(null, "binding-version_v1___", ""))
},
- ) { (bindingVersion, versionPrefix) ->
+ ) { (bindingVersion, versionPrefix, versionSuffix) ->
context("parseRequest") {
test("parses owner/name with version and no path, FULL by default") {
- val parameters = createParameters(owner = "o", name = "act", version = "${versionPrefix}v1")
+ val parameters =
+ createParameters(owner = "o", name = "act", version = "${versionPrefix}v1$versionSuffix")
if (bindingVersion == null) {
parameters.parseRequest(extractVersion = true).shouldBeNull()
@@ -47,7 +60,7 @@ class RequestParsingTest :
parameters.parseRequest(extractVersion = true) shouldBe
BindingsServerRequest(
rawName = "act",
- rawVersion = "${versionPrefix}v1",
+ rawVersion = "${versionPrefix}v1$versionSuffix",
bindingVersion = bindingVersion,
actionCoords =
ActionCoords(
@@ -63,7 +76,11 @@ class RequestParsingTest :
test("parses owner/name with path and significant version suffix") {
val parameters =
- createParameters(owner = "o", name = "act__p1__p2___major", version = "${versionPrefix}v9")
+ createParameters(
+ owner = "o",
+ name = "act__p1__p2___major",
+ version = "${versionPrefix}v9$versionSuffix",
+ )
if (bindingVersion == null) {
parameters.parseRequest(extractVersion = true).shouldBeNull()
@@ -71,7 +88,7 @@ class RequestParsingTest :
parameters.parseRequest(extractVersion = true) shouldBe
BindingsServerRequest(
rawName = "act__p1__p2___major",
- rawVersion = "${versionPrefix}v9",
+ rawVersion = "${versionPrefix}v9$versionSuffix",
bindingVersion = bindingVersion,
actionCoords =
ActionCoords(
@@ -128,7 +145,7 @@ class RequestParsingTest :
createParameters(
owner = "o",
name = "my_action-name__dir_one__dir-two___minor",
- version = "${versionPrefix}v2",
+ version = "${versionPrefix}v2$versionSuffix",
)
if (bindingVersion == null) {
@@ -137,7 +154,7 @@ class RequestParsingTest :
parameters.parseRequest(extractVersion = true) shouldBe
BindingsServerRequest(
rawName = "my_action-name__dir_one__dir-two___minor",
- rawVersion = "${versionPrefix}v2",
+ rawVersion = "${versionPrefix}v2$versionSuffix",
bindingVersion = bindingVersion,
actionCoords =
ActionCoords(
@@ -156,7 +173,8 @@ class RequestParsingTest :
createParameters(
owner = "o",
name = "act___commit_lenient",
- version = "${versionPrefix}v1.2.3__323898970401d85df44b3324a610af9a862d54b3",
+ version =
+ "${versionPrefix}v1.2.3__323898970401d85df44b3324a610af9a862d54b3$versionSuffix",
)
if (bindingVersion == null) {
@@ -165,7 +183,9 @@ class RequestParsingTest :
parameters.parseRequest(extractVersion = true) shouldBe
BindingsServerRequest(
rawName = "act___commit_lenient",
- rawVersion = "${versionPrefix}v1.2.3__323898970401d85df44b3324a610af9a862d54b3",
+ rawVersion =
+ "${versionPrefix}v1.2.3__323898970401d85df44b3324a610af9a862d54b3" +
+ versionSuffix,
bindingVersion = bindingVersion,
actionCoords =
ActionCoords(
@@ -186,7 +206,7 @@ class RequestParsingTest :
createParameters(
owner = "o",
name = "act___commit_lenient",
- version = "${versionPrefix}v1.2.3",
+ version = "${versionPrefix}v1.2.3$versionSuffix",
)
parameters.parseRequest(extractVersion = true).shouldBeNull()
diff --git a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuilding.kt b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuilding.kt
index 68fad7bb1e..e3bb6e8985 100644
--- a/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuilding.kt
+++ b/maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuilding.kt
@@ -38,11 +38,11 @@ internal suspend fun BindingsServerRequest.buildMavenMetadataFile(
prefetchBindingArtifacts(
availableVersions.flatMap {
flow {
- emit(V1 to "")
- BindingVersion.entries.forEach { emit(it to "binding_version_${it}___") }
- }.map { (bindingVersion, versionPrefix) ->
+ BindingVersion.entries.forEach { emit(it) }
+ }.map { bindingVersion ->
copy(
- rawVersion = "$versionPrefix$it${if (commitLenient) "__${it.getSha()}" else ""}",
+ rawVersion =
+ "binding_version_${bindingVersion}___$it${if (commitLenient) "__${it.getSha()}" else ""}${if (bindingVersion.isExperimental) "-beta" else ""}",
bindingVersion = bindingVersion,
actionCoords =
actionCoords.copy(
@@ -59,21 +59,23 @@ internal suspend fun BindingsServerRequest.buildMavenMetadataFile(
DateTimeFormatter
.ofPattern("yyyyMMddHHmmss")
.format(newest.getReleaseDate())
+ val latestStableBindingVersion = BindingVersion.entries.last { !it.isExperimental }
return """
${actionCoords.owner}
$rawName
- binding_version_${BindingVersion.entries.last()}___$newest${if (commitLenient) "__${newest.getSha()}" else ""}
- binding_version_${BindingVersion.entries.last()}___$newest${if (commitLenient) "__${newest.getSha()}" else ""}
+ binding_version_${latestStableBindingVersion}___$newest${if (commitLenient) "__${newest.getSha()}" else ""}
+ binding_version_${latestStableBindingVersion}___$newest${if (commitLenient) "__${newest.getSha()}" else ""}
${availableVersions.map {
flow {
- emit("")
- BindingVersion.entries.forEach { emit("binding_version_${it}___") }
- }.map { versionPrefix ->
- " $versionPrefix$it${if (commitLenient) "__${it.getSha()}" else ""}"
+ BindingVersion.entries.forEach {
+ emit("binding_version_${it}___" to (if (it.isExperimental) "-beta" else ""))
+ }
+ }.map { (versionPrefix, versionSuffix) ->
+ " $versionPrefix$it${if (commitLenient) "__${it.getSha()}" else ""}$versionSuffix"
}.toList()
.joinToString(separator = "\n")
}.joinToString(separator = "\n")}
diff --git a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt
index eb76317230..aa1889791a 100644
--- a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt
+++ b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/MavenMetadataBuildingTest.kt
@@ -61,6 +61,7 @@ class MavenMetadataBuildingTest :
prefetchBindingArtifacts = { prefetchedCoords = it },
)
+ val latestStableBindingVersion = BindingVersion.entries.last { !it.isExperimental }
xml shouldBe
"""
@@ -68,21 +69,15 @@ class MavenMetadataBuildingTest :
owner
name
- binding_version_${BindingVersion.entries.last()}___v2
- binding_version_${BindingVersion.entries.last()}___v2
+ binding_version_${latestStableBindingVersion}___v2
+ binding_version_${latestStableBindingVersion}___v2
- v2
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v2"
- }.joinToString(separator = "\n")
- }
- v1
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1"
- }.joinToString(separator = "\n")
- }
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v2${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1${if (it.isExperimental) "-beta" else ""}"
+ }}
20240501000000
@@ -92,33 +87,12 @@ ${
prefetchedCoords shouldNotBe null
prefetchedCoords shouldContainExactlyInAnyOrder
sequence {
- yield(
- bindingsServerRequest.copy(
- rawName = "name",
- rawVersion = "v1",
- actionCoords =
- bindingsServerRequest.actionCoords.copy(
- version = "v1",
- versionForTypings = "v1",
- ),
- ),
- )
- yield(
- bindingsServerRequest.copy(
- rawName = "name",
- rawVersion = "v2",
- actionCoords =
- bindingsServerRequest.actionCoords.copy(
- version = "v2",
- versionForTypings = "v2",
- ),
- ),
- )
BindingVersion.entries.forEach { bindingVersion ->
yield(
bindingsServerRequest.copy(
rawName = "name",
- rawVersion = "binding_version_${bindingVersion}___v1",
+ rawVersion =
+ "binding_version_${bindingVersion}___v1${if (bindingVersion.isExperimental) "-beta" else ""}",
bindingVersion = bindingVersion,
actionCoords =
bindingsServerRequest.actionCoords.copy(
@@ -130,7 +104,8 @@ ${
yield(
bindingsServerRequest.copy(
rawName = "name",
- rawVersion = "binding_version_${bindingVersion}___v2",
+ rawVersion =
+ "binding_version_${bindingVersion}___v2${if (bindingVersion.isExperimental) "-beta" else ""}",
bindingVersion = bindingVersion,
actionCoords =
bindingsServerRequest.actionCoords.copy(
@@ -271,6 +246,7 @@ ${
prefetchBindingArtifacts = { prefetchedCoords = it },
)
+ val latestStableBindingVersion = BindingVersion.entries.last { !it.isExperimental }
val commitLenient = significantVersion == COMMIT_LENIENT
xml shouldBe
"""
@@ -279,57 +255,33 @@ ${
owner
name___$significantVersion
- binding_version_${BindingVersion.entries.last()}___v2${if (commitLenient) "__2" else ""}
- binding_version_${BindingVersion.entries.last()}___v2${if (commitLenient) "__2" else ""}
+ binding_version_${latestStableBindingVersion}___v2${if (commitLenient) "__2" else ""}
+ binding_version_${latestStableBindingVersion}___v2${if (commitLenient) "__2" else ""}
- v3-beta${if (commitLenient) "__1" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v3-beta${if (commitLenient) "__1" else ""}"
- }.joinToString(separator = "\n")
- }
- v2${if (commitLenient) "__2" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v2${if (commitLenient) "__2" else ""}"
- }.joinToString(separator = "\n")
- }
- v1${if (commitLenient) "__3" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1${if (commitLenient) "__3" else ""}"
- }.joinToString(separator = "\n")
- }
- v1.1${if (commitLenient) "__4" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1.1${if (commitLenient) "__4" else ""}"
- }.joinToString(separator = "\n")
- }
- v1.1.0${if (commitLenient) "__5" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1.1.0${if (commitLenient) "__5" else ""}"
- }.joinToString(separator = "\n")
- }
- v1.0.1${if (commitLenient) "__6" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1.0.1${if (commitLenient) "__6" else ""}"
- }.joinToString(separator = "\n")
- }
- v1.0${if (commitLenient) "__7" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1.0${if (commitLenient) "__7" else ""}"
- }.joinToString(separator = "\n")
- }
- v1.0.0${if (commitLenient) "__8" else ""}
-${
- BindingVersion.entries.map {
- " binding_version_${it}___v1.0.0${if (commitLenient) "__8" else ""}"
- }.joinToString(separator = "\n")
- }
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v3-beta${if (commitLenient) "__1" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v2${if (commitLenient) "__2" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1${if (commitLenient) "__3" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1.1${if (commitLenient) "__4" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1.1.0${if (commitLenient) "__5" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1.0.1${if (commitLenient) "__6" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1.0${if (commitLenient) "__7" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
+${BindingVersion.entries.joinToString(separator = "\n") {
+ " binding_version_${it}___v1.0.0${if (commitLenient) "__8" else ""}${if (it.isExperimental) "-beta" else ""}"
+ }}
20240501000000
@@ -340,27 +292,12 @@ ${
prefetchedCoords shouldContainExactlyInAnyOrder
flow {
availableVersions.map { it to it.getSha() }.forEach { (availableVersion, sha) ->
- emit(
- bindingsServerRequest.copy(
- rawName = "name___$significantVersion",
- rawVersion =
- "$availableVersion${if (commitLenient) "__${availableVersion.getSha()}" else ""}",
- actionCoords =
- bindingsServerRequest.actionCoords.copy(
- version =
- if (commitLenient) availableVersion.getSha()!! else "$availableVersion",
- comment = if (commitLenient) "$availableVersion" else null,
- significantVersion = significantVersion,
- versionForTypings = "$availableVersion",
- ),
- ),
- )
BindingVersion.entries.forEach { bindingVersion ->
emit(
bindingsServerRequest.copy(
rawName = "name___$significantVersion",
rawVersion =
- "binding_version_${bindingVersion}___$availableVersion${if (commitLenient) "__${availableVersion.getSha()}" else ""}",
+ "binding_version_${bindingVersion}___$availableVersion${if (commitLenient) "__${availableVersion.getSha()}" else ""}${if (bindingVersion.isExperimental) "-beta" else ""}",
bindingVersion = bindingVersion,
actionCoords =
bindingsServerRequest.actionCoords.copy(
diff --git a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt
index 18465a027a..ccda6b2f71 100644
--- a/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt
+++ b/maven-binding-builder/src/test/kotlin/io/github/typesafegithub/workflows/mavenbinding/PomBuildingTest.kt
@@ -4,66 +4,70 @@ import io.github.typesafegithub.workflows.actionbindinggenerator.domain.ActionCo
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.SignificantVersion
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.SignificantVersion.COMMIT_LENIENT
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.SignificantVersion.FULL
+import io.github.typesafegithub.workflows.testutils.withAllBindingVersions
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
class PomBuildingTest :
FunSpec({
- SignificantVersion.entries.forEach { significantVersion ->
- test("significant version $significantVersion requested") {
- // given
- val commitLenient = significantVersion == COMMIT_LENIENT
- var nameSuffix = if (significantVersion == FULL) "" else "___$significantVersion"
- var versionSuffix = if (commitLenient) "__commit-sha" else ""
- var prettyPrintSuffix =
- when (significantVersion) {
- FULL -> ""
- COMMIT_LENIENT -> " with $significantVersion version and comment 'v1.2.3'"
- else -> " with $significantVersion version"
- }
- var version = if (commitLenient) "commit-sha" else "v1.2.3"
+ withAllBindingVersions { bindingVersion ->
+ SignificantVersion.entries.forEach { significantVersion ->
+ test("significant version $significantVersion requested") {
+ // given
+ val commitLenient = significantVersion == COMMIT_LENIENT
+ var nameSuffix = if (significantVersion == FULL) "" else "___$significantVersion"
+ var versionSuffix = if (commitLenient) "__commit-sha" else ""
+ var prettyPrintSuffix =
+ when (significantVersion) {
+ FULL -> ""
+ COMMIT_LENIENT -> " with $significantVersion version and comment 'v1.2.3'"
+ else -> " with $significantVersion version"
+ }
+ var version = if (commitLenient) "commit-sha" else "v1.2.3"
- val bindingsServerRequest =
- BindingsServerRequest(
- rawName = "name$nameSuffix",
- rawVersion = "v1.2.3$versionSuffix",
- actionCoords =
- ActionCoords(
- owner = "owner",
- name = "name",
- version = version,
- comment = if (commitLenient) "v1.2.3" else null,
- significantVersion = significantVersion,
- ),
- )
- val xml = bindingsServerRequest.buildPomFile("4.5.6")
+ val bindingsServerRequest =
+ BindingsServerRequest(
+ rawName = "name$nameSuffix",
+ rawVersion = "v1.2.3$versionSuffix",
+ bindingVersion = bindingVersion,
+ actionCoords =
+ ActionCoords(
+ owner = "owner",
+ name = "name",
+ version = version,
+ comment = if (commitLenient) "v1.2.3" else null,
+ significantVersion = significantVersion,
+ ),
+ )
+ val xml = bindingsServerRequest.buildPomFile("4.5.6")
- xml shouldBe
- """
-
-
- 4.0.0
- owner
- name$nameSuffix
- v1.2.3$versionSuffix
- name
- Auto-generated binding for owner/name$prettyPrintSuffix@$version binding version v1.
- https://github.com/owner/name
-
- scm:git:git://github.com/owner/name.git/
- scm:git:ssh://github.com:owner/name.git
- https://github.com/owner/name.git
-
-
-
- io.github.typesafegithub
- github-workflows-kt
- 4.5.6
- compile
-
-
-
- """.trimIndent()
+ xml shouldBe
+ """
+
+
+ 4.0.0
+ owner
+ name$nameSuffix
+ v1.2.3$versionSuffix
+ name
+ Auto-generated binding for owner/name$prettyPrintSuffix@$version binding version $bindingVersion.
+ https://github.com/owner/name
+
+ scm:git:git://github.com/owner/name.git/
+ scm:git:ssh://github.com:owner/name.git
+ https://github.com/owner/name.git
+
+
+
+ io.github.typesafegithub
+ github-workflows-kt
+ 4.5.6
+ compile
+
+
+
+ """.trimIndent()
+ }
}
}
})
diff --git a/mkdocs.yml b/mkdocs.yml
index c604c09a42..39e0435860 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -34,6 +34,11 @@ markdown_extensions:
check_paths: True
dedent_subsections: True
- admonition
+ - pymdownx.emoji:
+ emoji_index: !!python/name:material.extensions.emoji.twemoji
+ emoji_generator: !!python/name:material.extensions.emoji.to_svg
+ - def_list
+ - attr_list
plugins:
- search
diff --git a/test-utils/build.gradle.kts b/test-utils/build.gradle.kts
index f2c02a8362..60c6854342 100644
--- a/test-utils/build.gradle.kts
+++ b/test-utils/build.gradle.kts
@@ -6,4 +6,6 @@ dependencies {
implementation(platform("io.kotest:kotest-bom:6.1.11"))
implementation("io.kotest:kotest-assertions-core")
implementation("io.kotest:kotest-common")
+ implementation("io.kotest:kotest-framework-engine")
+ implementation(projects.actionBindingGenerator)
}
diff --git a/test-utils/src/main/kotlin/io/github/typesafegithub/workflows/testutils/BindingVersionUtils.kt b/test-utils/src/main/kotlin/io/github/typesafegithub/workflows/testutils/BindingVersionUtils.kt
new file mode 100644
index 0000000000..bb5e29edec
--- /dev/null
+++ b/test-utils/src/main/kotlin/io/github/typesafegithub/workflows/testutils/BindingVersionUtils.kt
@@ -0,0 +1,168 @@
+package io.github.typesafegithub.workflows.testutils
+
+import io.github.typesafegithub.workflows.actionbindinggenerator.versioning.BindingVersion
+import io.kotest.core.spec.style.scopes.DescribeSpecContainerScope
+import io.kotest.core.spec.style.scopes.DescribeSpecRootScope
+import io.kotest.core.spec.style.scopes.FunSpecContainerScope
+import io.kotest.core.spec.style.scopes.FunSpecRootScope
+import io.kotest.core.test.TestScope
+import io.kotest.datatest.withContexts
+import io.kotest.datatest.withIts
+import io.kotest.datatest.withTests
+import kotlin.ranges.rangeTo
+
+fun FunSpecRootScope.withBindingVersions(
+ bindingVersions: Iterable,
+ test: suspend FunSpecContainerScope.(BindingVersion) -> Unit,
+) = withContexts(
+ nameFn = { "binding version $it" },
+ ts = bindingVersions,
+ test = test,
+)
+
+fun FunSpecRootScope.withAllBindingVersions(test: suspend FunSpecContainerScope.(BindingVersion) -> Unit) =
+ withBindingVersions(
+ bindingVersions = BindingVersion.entries,
+ test = test,
+ )
+
+fun FunSpecRootScope.withBindingVersions(
+ bindingVersions: OpenEndRange,
+ test: suspend FunSpecContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+fun FunSpecRootScope.withBindingVersions(
+ bindingVersions: ClosedRange,
+ test: suspend FunSpecContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+fun FunSpecRootScope.withBindingVersionsFrom(
+ bindingVersion: BindingVersion,
+ test: suspend FunSpecContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = bindingVersion..BindingVersion.entries.last(),
+ test = test,
+)
+
+suspend fun FunSpecContainerScope.withBindingVersions(
+ bindingVersions: Iterable,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withTests(
+ nameFn = { "binding version $it" },
+ ts = bindingVersions,
+ test = test,
+)
+
+suspend fun FunSpecContainerScope.withAllBindingVersions(test: suspend TestScope.(BindingVersion) -> Unit) =
+ withBindingVersions(
+ bindingVersions = BindingVersion.entries,
+ test = test,
+ )
+
+suspend fun FunSpecContainerScope.withBindingVersions(
+ bindingVersions: OpenEndRange,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+suspend fun FunSpecContainerScope.withBindingVersions(
+ bindingVersions: ClosedRange,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+suspend fun FunSpecContainerScope.withBindingVersionsFrom(
+ bindingVersion: BindingVersion,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = bindingVersion..BindingVersion.entries.last(),
+ test = test,
+)
+
+fun DescribeSpecRootScope.withBindingVersions(
+ bindingVersions: Iterable,
+ test: suspend DescribeSpecContainerScope.(BindingVersion) -> Unit,
+) = withContexts(
+ nameFn = { "binding version $it" },
+ ts = bindingVersions,
+ test = test,
+)
+
+fun DescribeSpecRootScope.withAllBindingVersions(test: suspend DescribeSpecContainerScope.(BindingVersion) -> Unit) =
+ withBindingVersions(
+ bindingVersions = BindingVersion.entries,
+ test = test,
+ )
+
+fun DescribeSpecRootScope.withBindingVersions(
+ bindingVersions: OpenEndRange,
+ test: suspend DescribeSpecContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+fun DescribeSpecRootScope.withBindingVersions(
+ bindingVersions: ClosedRange,
+ test: suspend DescribeSpecContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+fun DescribeSpecRootScope.withBindingVersionsFrom(
+ bindingVersion: BindingVersion,
+ test: suspend DescribeSpecContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = bindingVersion..BindingVersion.entries.last(),
+ test = test,
+)
+
+suspend fun DescribeSpecContainerScope.withBindingVersions(
+ bindingVersions: Iterable,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withIts(
+ nameFn = { "binding version $it" },
+ ts = bindingVersions,
+ test = test,
+)
+
+suspend fun DescribeSpecContainerScope.withAllBindingVersions(test: suspend TestScope.(BindingVersion) -> Unit) =
+ withBindingVersions(
+ bindingVersions = BindingVersion.entries,
+ test = test,
+ )
+
+suspend fun DescribeSpecContainerScope.withBindingVersions(
+ bindingVersions: OpenEndRange,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+suspend fun DescribeSpecContainerScope.withBindingVersions(
+ bindingVersions: ClosedRange,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+suspend fun DescribeSpecContainerScope.withBindingVersionsFrom(
+ bindingVersion: BindingVersion,
+ test: suspend TestScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = bindingVersion..BindingVersion.entries.last(),
+ test = test,
+)