diff --git a/.github/workflows/bindings-server.main.kts b/.github/workflows/bindings-server.main.kts
index 7df37f2dc0..3c85caae3f 100755
--- a/.github/workflows/bindings-server.main.kts
+++ b/.github/workflows/bindings-server.main.kts
@@ -101,6 +101,16 @@ workflow(
cleanMavenLocal()
+ run(
+ name = "Execute the script using the bindings from the server with v2 route",
+ command = """
+ 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(),
+ )
+
+ cleanMavenLocal()
+
run(
name = "Execute the script using bindings but without dependency on library",
command = """
diff --git a/.github/workflows/bindings-server.yaml b/.github/workflows/bindings-server.yaml
index 993d82ea07..0b1ce8d916 100644
--- a/.github/workflows/bindings-server.yaml
+++ b/.github/workflows/bindings-server.yaml
@@ -65,22 +65,30 @@ jobs:
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- id: 'step-9'
+ name: 'Execute the script using the bindings from the server with v2 route'
+ run: |-
+ 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-10'
+ name: 'Clean Maven Local to fetch required POMs again'
+ run: 'rm -rf ~/.m2/repository/'
+ - id: 'step-11'
name: 'Execute the script using bindings but without dependency on library'
run: |-
mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
.github/workflows/test-served-bindings-depend-on-library.main.kts
- - id: 'step-10'
+ - id: 'step-12'
name: 'Clean Maven Local to fetch required POMs again'
run: 'rm -rf ~/.m2/repository/'
- - id: 'step-11'
+ - id: 'step-13'
name: 'Compile a Gradle project using the bindings from the server'
run: |-
cd .github/workflows/test-gradle-project-using-bindings-server
./gradlew build
- - id: 'step-12'
+ - id: 'step-14'
name: 'Fetch maven-metadata.xml for top-level action'
run: 'curl --fail http://localhost:8080/actions/checkout/maven-metadata.xml | grep ''v4'''
- - id: 'step-13'
+ - id: 'step-15'
name: 'Fetch maven-metadata.xml for nested action'
run: 'curl --fail http://localhost:8080/actions/cache__save/maven-metadata.xml | grep ''v4'''
deploy:
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 0104863de3..6a03dcc061 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/v1")
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..eab3179228
--- /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/v2")
+
+// 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")
+
+// Always untyped action.
+@file:DependsOn("typesafegithub:always-untyped-action-for-tests:v1")
+
+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
index 92fe969476..8e7cd6113e 100755
--- 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
@@ -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/action-binding-generator/api/action-binding-generator.api b/action-binding-generator/api/action-binding-generator.api
index 1073480181..0f40016c49 100644
--- a/action-binding-generator/api/action-binding-generator.api
+++ b/action-binding-generator/api/action-binding-generator.api
@@ -184,6 +184,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 eba58244c6..fb8666ac97 100644
--- a/action-binding-generator/build.gradle.kts
+++ b/action-binding-generator/build.gradle.kts
@@ -18,6 +18,8 @@ dependencies {
implementation("io.github.oshai:kotlin-logging:7.0.3")
implementation(projects.sharedInternal)
+ testImplementation("io.kotest:kotest-framework-datatest")
+ testImplementation(kotlin("reflect"))
testImplementation(projects.githubWorkflowsKt)
}
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 14f1b4b9af..160c0101a0 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.0.1"),
+ V2(libraryVersion = "3.0.1"),
;
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 cfe5d5311b..662b75f80a 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,8 +1,14 @@
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.common.mapError
+import io.kotest.core.spec.style.scopes.ContainerScope
+import io.kotest.datatest.withData
import io.kotest.matchers.Matcher.Companion.failure
import io.kotest.matchers.shouldBe
+import java.lang.reflect.InvocationTargetException
import java.nio.file.Paths
fun List.shouldContainAndMatchFile(path: String) {
@@ -36,3 +42,68 @@ 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
+ .constructors
+ .first()
+ return runCatching {
+ constructor.callBy(
+ arguments.mapKeys { (key, _) ->
+ constructor.parameters.first { it.name == key }
+ },
+ )
+ }.mapError {
+ if (it is InvocationTargetException) it.targetException else it
+ }.getOrThrow()
+}
+
+suspend fun ContainerScope.withBindingVersions(
+ bindingVersions: Iterable,
+ test: suspend ContainerScope.(BindingVersion) -> Unit,
+) = withData(
+ nameFn = { "binding version $it" },
+ ts = bindingVersions,
+ test = test,
+)
+
+suspend fun ContainerScope.withAllBindingVersions(test: suspend ContainerScope.(BindingVersion) -> Unit) =
+ withBindingVersions(
+ bindingVersions = BindingVersion.entries,
+ test = test,
+ )
+
+suspend fun ContainerScope.withBindingVersions(
+ bindingVersions: OpenEndRange,
+ test: suspend ContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+suspend fun ContainerScope.withBindingVersions(
+ bindingVersions: ClosedRange,
+ test: suspend ContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = BindingVersion.entries.filter { it in bindingVersions },
+ test = test,
+)
+
+suspend fun ContainerScope.withBindingVersionsFrom(
+ bindingVersion: BindingVersion,
+ test: suspend ContainerScope.(BindingVersion) -> Unit,
+) = withBindingVersions(
+ bindingVersions = bindingVersion..BindingVersion.entries.last(),
+ test = test,
+)
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 85%
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 87c3742c40..756be74002 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,15 +301,15 @@ public data class ActionWithAllTypesOfInputs private constructor(
public sealed class Bin(
public val stringValue: String,
) {
- public object Foo : ActionWithAllTypesOfInputs.Bin("foo")
+ public object Foo : ActionWithAllTypesOfInputsBindingV1.Bin("foo")
- public object BooBar : ActionWithAllTypesOfInputs.Bin("boo-bar")
+ public object BooBar : ActionWithAllTypesOfInputsBindingV1.Bin("boo-bar")
- public object Baz123 : ActionWithAllTypesOfInputs.Bin("baz123")
+ public object Baz123 : ActionWithAllTypesOfInputsBindingV1.Bin("baz123")
public class Custom(
customStringValue: String,
- ) : ActionWithAllTypesOfInputs.Bin(customStringValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.Bin(customStringValue)
}
public sealed class Zen(
@@ -317,35 +317,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 Two : ActionWithAllTypesOfInputs.MyEnum("two")
+ public object Two : ActionWithAllTypesOfInputsBindingV1.MyEnum("two")
- public object Three : ActionWithAllTypesOfInputs.MyEnum("three")
+ public object Three : ActionWithAllTypesOfInputsBindingV1.MyEnum("three")
public class Custom(
customStringValue: String,
- ) : ActionWithAllTypesOfInputs.MyEnum(customStringValue)
+ ) : ActionWithAllTypesOfInputsBindingV1.MyEnum(customStringValue)
}
public sealed class MyInt(
@@ -353,9 +353,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..a56caad041
--- /dev/null
+++ b/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithAllTypesOfInputsBindingV2.kt
@@ -0,0 +1,377 @@
+// 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 Foo : ActionWithAllTypesOfInputsBindingV2.Bin("foo")
+
+ public object BooBar : ActionWithAllTypesOfInputsBindingV2.Bin("boo-bar")
+
+ public object Baz123 : ActionWithAllTypesOfInputsBindingV2.Bin("baz123")
+
+ 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 Two : ActionWithAllTypesOfInputsBindingV2.MyEnum("two")
+
+ public object Three : ActionWithAllTypesOfInputsBindingV2.MyEnum("three")
+
+ 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..508421d597 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,293 @@
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.actionbindinggenerator.withAllBindingVersions
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithAllTypesOfInputsBindingV1
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithAllTypesOfInputsBindingV2
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))
- )
+ context("correctly translates all types of inputs") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = 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"),
- )
+ context("works for custom values") {
+ withAllBindingVersions { bindingVersion ->
+ // 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",
- )
+ // 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 = 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"),
- )
+ context("untyped input is sufficient for required input") {
+ withAllBindingVersions { bindingVersion ->
+ // 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",
- )
+ // 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 {
- ActionWithAllTypesOfInputs()
- }
- exception.message shouldBe "Either fooBar or fooBar_Untyped must be set, one of them is required"
+ context("validates required inputs are not missing") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 {
- ActionWithAllTypesOfInputs(
- fooBar = "test",
- fooBar_Untyped = "untyped test",
- )
- }
- exception.message shouldBe "Only fooBar or fooBar_Untyped must be set, but not both"
+ context("validates required inputs are not supplied typed and untyped") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 {
- 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"
+ context("validates not-required inputs are not supplied typed and untyped") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = 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))
- )
+ context("exposes copy method") {
+ withAllBindingVersions { bindingVersion ->
+ // 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")
- // when
- @Suppress("DATA_CLASS_INVISIBLE_COPY_USAGE_WARNING")
- val actionWithOneChange = action.copy(fooBar = "another")
+ // then
+ actionWithOneChange.fooBar shouldBe "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"
+ }
+ }
+ }
}
})
+
+private val BindingVersion.finBin
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Bin.BooBar
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Bin.BooBar
+ }
+
+private val BindingVersion.customFinBin
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Bin.Custom("this-is-custom!")
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Bin.Custom("this-is-custom!")
+ }
+
+private val BindingVersion.gooZen
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Zen.Special1
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Zen.Special1
+ }
+
+private val BindingVersion.customGooZen
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.Zen.Value(123)
+ V2 -> ActionWithAllTypesOfInputsBindingV2.Zen.Value(123)
+ }
+
+private val BindingVersion.bahEnum
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.BahEnum.HelloWorld
+ V2 -> ActionWithAllTypesOfInputsBindingV2.BahEnum.HelloWorld
+ }
+
+private val BindingVersion.customBahEnum
+ get() = when (this) {
+ V1 -> ActionWithAllTypesOfInputsBindingV1.BahEnum.Custom("very-custom")
+ V2 -> ActionWithAllTypesOfInputsBindingV2.BahEnum.Custom("very-custom")
+ }
+
+private val BindingVersion.listEnums
+ get() = when (this) {
+ V1 -> listOf(ActionWithAllTypesOfInputsBindingV1.MyEnum.One, ActionWithAllTypesOfInputsBindingV1.MyEnum.Three)
+ V2 -> listOf(ActionWithAllTypesOfInputsBindingV2.MyEnum.One, ActionWithAllTypesOfInputsBindingV2.MyEnum.Three)
+ }
+
+private val BindingVersion.listIntSpecial
+ get() = when (this) {
+ V1 -> listOf(
+ ActionWithAllTypesOfInputsBindingV1.MyInt.TheAnswer,
+ ActionWithAllTypesOfInputsBindingV1.MyInt.Value(0),
+ )
+
+ V2 -> listOf(
+ ActionWithAllTypesOfInputsBindingV2.MyInt.TheAnswer,
+ ActionWithAllTypesOfInputsBindingV2.MyInt.Value(0),
+ )
+ }
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/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..6d5c4c571a 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.actionbindinggenerator.withAllBindingVersions
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithOutputsBindingV1
+import io.github.typesafegithub.workflows.actions.johnsmith.ActionWithOutputsBindingV2
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")
+ context("fields have correct output placeholders") {
+ withAllBindingVersions { bindingVersion ->
+ // 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..7906f86eff 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.actionbindinggenerator.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"
- )
+ context("renders with defaults") {
+ withAllBindingVersions { bindingVersion ->
+ // 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..c487034cfb 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.actionbindinggenerator.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",
- )
+ context("renders with defaults") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 b0070d3b1f..265d134923 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
@@ -16,6 +16,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.actionbindinggenerator.withAllBindingVersions
import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.collections.shouldHaveSize
@@ -110,397 +111,430 @@ 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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("SimpleActionWithRequiredStringInputs.kt")
+ context("action with required inputs as strings, no outputs") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("SimpleActionWithRequiredStringInputsBinding${bindingVersion.name}.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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithSomeOptionalInputs.kt")
+ context("action with various combinations of input parameters describing being required or optional") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithSomeOptionalInputsBinding${bindingVersion.name}.kt")
+ }
}
- test("action with all types of inputs") {
- // given
- val coords = ActionCoords("john-smith", "action-with-all-types-of-inputs", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifestWithAllTypesOfInputsAndSomeOutput,
- inputTypings =
- Pair(
- typingsForAllTypesOfInputs,
- ACTION,
- ),
- )
-
- // then
- assertSoftly {
- binding.shouldContainAndMatchFile("ActionWithAllTypesOfInputs.kt")
- binding.shouldContainAndMatchFile("ActionWithAllTypesOfInputs_Untyped.kt")
+ context("action with all types of inputs") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 =
+ Pair(
+ typingsForAllTypesOfInputs,
+ ACTION,
+ ),
+ )
+
+ // then
+ assertSoftly {
+ binding.shouldContainAndMatchFile("ActionWithAllTypesOfInputsBinding${bindingVersion.name}.kt")
+ binding.shouldContainAndMatchFile("ActionWithAllTypesOfInputsBinding${bindingVersion.name}_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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithOutputs.kt")
+ context("action with outputs") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithOutputsBinding${bindingVersion.name}.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 = Pair(emptyMap(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithNoInputs.kt")
+ context("action with no inputs") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(emptyMap(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithNoInputsBinding${bindingVersion.name}.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", "sub/action")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = Pair(emptyMap(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithSubAction.kt")
+ context("subaction") {
+ withAllBindingVersions { bindingVersion ->
+ // 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", "sub/action")
+
+ // when
+ val binding =
+ coords.generateBinding(
+ bindingVersion = bindingVersion,
+ metadataRevision = NewestForVersion,
+ metadata = actionManifest,
+ inputTypings = Pair(emptyMap(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionBinding${bindingVersion.name}WithSubAction.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", "v2")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = Pair(actionManifest.allInputsAsStrings(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithDeprecatedInputAndNameClash.kt")
+ context("action with deprecated input resolving to the same Kotlin field name") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithDeprecatedInputAndNameClashBinding${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 =
- Pair(
+ context("action with inputs sharing type") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
- "foo-two" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
- "foo-three" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
+ "foo-one" to
+ Input(
+ required = true,
+ default = null,
+ ),
+ "foo-two" to
+ Input(
+ required = true,
+ default = null,
+ ),
+ "foo-three" to
+ Input(
+ required = false,
+ default = "test",
+ ),
),
- ACTION,
- ),
- )
+ )
+ 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 =
+ Pair(
+ 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)),
+ ),
+ ACTION,
+ ),
+ )
- // then
- binding.shouldContainAndMatchFile("ActionWithInputsSharingType.kt")
+ // then
+ binding.shouldContainAndMatchFile("ActionWithInputsSharingTypeBinding${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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
- )
-
- // then
- binding.shouldContainAndMatchFile("ActionWithFancyCharsInDocs.kt")
+ context("action with input descriptions with fancy characters") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(actionManifest.allInputsAsStrings(), ACTION),
+ )
+
+ // then
+ binding.shouldContainAndMatchFile("ActionWithFancyCharsInDocsBinding${bindingVersion.name}.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", "v3")
-
- // when
- val binding =
- coords.generateBinding(
- metadataRevision = NewestForVersion,
- metadata = actionManifest,
- inputTypings = Pair(emptyMap(), null),
- )
-
- // then
- binding shouldHaveSize 1
- binding.shouldContainAndMatchFile("ActionWithNoTypings_Untyped.kt")
+ context("action with no typings has only an untyped binding") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(emptyMap(), null),
+ )
+
+ // then
+ binding shouldHaveSize 1
+ binding.shouldContainAndMatchFile("ActionWithNoTypingsBinding${bindingVersion.name}_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 = Pair(mapOf("foo" to IntegerTyping), TYPING_CATALOG),
- )
-
- // then
- assertSoftly {
- binding.shouldContainAndMatchFile("ActionWithPartlyTypings.kt")
- binding.shouldContainAndMatchFile("ActionWithPartlyTypings_Untyped.kt")
+ context("action with partly typings has only untyped properties for the non-typed inputs") {
+ withAllBindingVersions { bindingVersion ->
+ // 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 = Pair(mapOf("foo" to IntegerTyping), TYPING_CATALOG),
+ )
+
+ // then
+ assertSoftly {
+ binding.shouldContainAndMatchFile("ActionWithPartlyTypingsBinding${bindingVersion.name}.kt")
+ binding.shouldContainAndMatchFile("ActionWithPartlyTypingsBinding${bindingVersion.name}_Untyped.kt")
+ }
}
}
})
diff --git a/docs/user-guide/using-actions.md b/docs/user-guide/using-actions.md
index c1828fb59f..d90246f29c 100644
--- a/docs/user-guide/using-actions.md
+++ b/docs/user-guide/using-actions.md
@@ -46,6 +46,85 @@ 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 repository URL
+
+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 delivered on a given repository URL should always stay
+backwards compatible (in terms of source compatibility). If accidentally a breaking change was done on given repository
+URL, please open a bug report. Unless very good reasons object, the change will be reverted and instead be done on
+a different repository URL. 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 repository URL is added, it will initially be in experimental state. When using such a URL, you get the
+ cutting edge changes, but no stability is guaranteed. Any breaking change can happen at any time, so use these URL
+ only if you have that in mind and consent to the consequences. Executing a workflow script with such a repository
+ URL will issue a warning and executing it on GitHub Actions will add a warning annotation to the workflow run.
+
+*Stable*
+
+: Repository URL that are in stable state will not have any source incompatible changes done. There will typically
+ only be one stable URL, and that is what you should usually use in your workflow scripts.
+
+*Deprecated*
+
+: Upon new stable URL becoming available, existing stable URL will most probably be moved to deprecated state.
+ Deprecated state for now does not mean, that the repository URL will be turned off. On a deprecated URL also no
+ source incompatible changes will be done, but new changes might not be added to the deprecated URL. The main
+ intention of deprecating a URL is to hint at newer stable URL being available. For this all bindings generated
+ on this URL 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.
+
+| Repository URL | Stability |
+|-------------------------------------|------------------------------------------------------------------------|
+| `https://bindings.krzeminski.it` | :material-check-bold:{ style="color: green" } stable (alias for `/v1`) |
+| `https://bindings.krzeminski.it/v1` | :material-check-bold:{ style="color: green" } stable |
+| `https://bindings.krzeminski.it/v2` | :no_entry: experimental |
+
+#### Library version compatibility
+
+As the library and / or generated bindings evolve, not all library versions will be compatible with all repository URL.
+This table lists which library versions are compatible with which repository URL.
+
+| Repository URL | Compatibility |
+|-------------------------------------|-------------------|
+| `https://bindings.krzeminski.it` | `3.0.0` and newer |
+| `https://bindings.krzeminski.it/v1` | `3.0.0` and newer |
+| `https://bindings.krzeminski.it/v2` | `3.0.0` and newer |
+
+#### Breaking changes
+
+This section shows which source incompatible breaking changes were done in each repository URL. When changing
+from a previous URL 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.
+
+`https://bindings.krzeminski.it/v2`
+
+: TBD
+
+`https://bindings.krzeminski.it` / `https://bindings.krzeminski.it/v1`
+
+: This is the original `v1` URL 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/mkdocs.yml b/mkdocs.yml
index 1492f9b592..64b63042ea 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -33,6 +33,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