Repository: typesafegithub/github-workflows-kt (kotlin)

Issue:
[Action wrapper(s) request] Vampire/setup-wsl
### Are you sure the action(s) you want aren't already supported?
_Please check https://krzema12.github.io/github-actions-kotlin-dsl/supported-actions/_

Yes

### What action(s) do you need?

https://github.com/Vampire/setup-wsl

Pull request:
closes #299

Patch:
diff --git a/docs/supported-actions.md b/docs/supported-actions.md
index fd35aabf01..d10b04cb3f 100644
--- a/docs/supported-actions.md
+++ b/docs/supported-actions.md
@@ -116,6 +116,8 @@ Click on a version to see the wrapper's code.
     * [flutter-action](https://github.com/subosito/flutter-action) - v2: [`FlutterActionV2`](https://github.com/krzema12/github-actions-kotlin-dsl/blob/v{{ version }}/library/src/gen/kotlin/it/krzeminski/githubactions/actions/subosito/FlutterActionV2.kt)
 * supercharge
     * [mongodb-github-action](https://github.com/supercharge/mongodb-github-action) - 1.7.0: [`MongodbGithubActionV1`](https://github.com/krzema12/github-actions-kotlin-dsl/blob/v{{ version }}/library/src/gen/kotlin/it/krzeminski/githubactions/actions/supercharge/MongodbGithubActionV1.kt)
+* Vampire
+    * [setup-wsl](https://github.com/Vampire/setup-wsl) - v1: [`SetupWslV1`](https://github.com/krzema12/github-actions-kotlin-dsl/blob/v{{ version }}/library/src/gen/kotlin/it/krzeminski/githubactions/actions/vampire/SetupWslV1.kt)
 * w9jds
     * [firebase-action](https://github.com/w9jds/firebase-action) - v2.2.2: [`FirebaseActionV2`](https://github.com/krzema12/github-actions-kotlin-dsl/blob/v{{ version }}/library/src/gen/kotlin/it/krzeminski/githubactions/actions/w9jds/FirebaseActionV2.kt)
 
@@ -123,5 +125,5 @@ Click on a version to see the wrapper's code.
 
 Number of wrappers available:
 
-* counting by actions: 72
-* counting each version separately: 85
+* counting by actions: 73
+* counting each version separately: 86
diff --git a/library/src/gen/kotlin/it/krzeminski/githubactions/actions/vampire/SetupWslV1.kt b/library/src/gen/kotlin/it/krzeminski/githubactions/actions/vampire/SetupWslV1.kt
new file mode 100644
index 0000000000..3665204287
--- /dev/null
+++ b/library/src/gen/kotlin/it/krzeminski/githubactions/actions/vampire/SetupWslV1.kt
@@ -0,0 +1,163 @@
+// This file was generated using 'wrapper-generator' module. Don't change it by hand, your changes will
+// be overwritten with the next wrapper code regeneration. Instead, consider introducing changes to the
+// generator itself.
+package it.krzeminski.githubactions.actions.vampire
+
+import it.krzeminski.githubactions.actions.ActionWithOutputs
+import kotlin.Boolean
+import kotlin.String
+import kotlin.Suppress
+import kotlin.collections.List
+import kotlin.collections.Map
+import kotlin.collections.toList
+import kotlin.collections.toTypedArray
+
+/**
+ * Action: Setup WSL
+ *
+ * WSL Setup GitHub Action
+ *
+ * [Action on GitHub](https://github.com/Vampire/setup-wsl)
+ */
+public class SetupWslV1(
+    /**
+     * The WSL distribution to install, update, or configure.
+     * Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-20.04',
+     * 'Ubuntu-18.04', 'Ubuntu-16.04'
+     */
+    public val distribution: SetupWslV1.Distribution? = null,
+    /**
+     * Whether to use the cache for the downloaded distribution installer.
+     * This saves time in subsequent runs, jobs, or workflows but consumes space from
+     * the available cache space of the repository.
+     * Refer to https://github.com/marketplace/actions/cache for current usage limits.
+     */
+    public val useCache: Boolean? = null,
+    /**
+     * The content that will be written to /etc/wsl.conf of the installed distribution.
+     * This can be used to adjust various settings as documented at
+     * https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configuration-settings-for-wslconf.
+     * This can also be used if the distribution is installed already.
+     */
+    public val wslConf: String? = null,
+    /**
+     * Whether to set the distribution as default WSL distribution.
+     * This can also be used if the distribution is installed already.
+     * Default is 'true' if the distribution is going to be installed.
+     * Default is 'false' if the distribution is only getting configured, updated, or additional
+     * packages installed.
+     * The first installed WSL distribution is automatically the default one, independently of this
+     * input.
+     */
+    public val setAsDefault: Boolean? = null,
+    /**
+     * Whether to update the distribution after installation.
+     * This can also be used if the distribution is installed already.
+     */
+    public val update: Boolean? = null,
+    /**
+     * Space separated list of additional packages to install after distribution installation.
+     * This can also be used if the distribution is installed already.
+     */
+    public val additionalPackages: List<String>? = null,
+    /**
+     * The distribution user that should be used to execute run-step scripts with wsl-shell wrapper
+     * scripts
+     * that are created or updated by the current action invocation. If no value is given, the
+     * default user of
+     * the distribution at script execution time is used.
+     */
+    public val wslShellUser: String? = null,
+    /**
+     * The command that is used in the wsl-shell wrapper scripts to execute the run-step script.
+     * The name of the wrapper scripts will be derived from the first word in this input prefixed
+     * with 'wsl-'.
+     * This means that for the default value, the wrapper scripts will start with 'wsl-bash'.
+     * The run-step script file will be given as additional parameter in single quotes after the
+     * given string,
+     * separated with one space character. The latter point is important, if you need to escape this
+     * space character.
+     * If the given string contains at least once the sequence '{0}', all occurrences of it will be
+     * replaced by the
+     * run-step script file without any quotes or anything and it will not be given as additional
+     * parameter.
+     * This can be used if the script file is needed within the shell command opposed to as
+     * additional parameter.
+     * This input can also be used if the distribution is installed already to change the wrapper
+     * scripts or generate
+     * additional ones for other shells.
+     */
+    public val wslShellCommand: String? = null,
+    /**
+     * Type-unsafe map where you can put any inputs that are not yet supported by the wrapper
+     */
+    public val _customInputs: Map<String, String> = mapOf(),
+    /**
+     * Allows overriding action's version, for example to use a specific minor version, or a newer
+     * version that the wrapper doesn't yet know about
+     */
+    _customVersion: String? = null,
+) : ActionWithOutputs<SetupWslV1.Outputs>("Vampire", "setup-wsl", _customVersion ?: "v1") {
+    @Suppress("SpreadOperator")
+    public override fun toYamlArguments() = linkedMapOf(
+        *listOfNotNull(
+            distribution?.let { "distribution" to it.stringValue },
+            useCache?.let { "use-cache" to it.toString() },
+            wslConf?.let { "wsl-conf" to it },
+            setAsDefault?.let { "set-as-default" to it.toString() },
+            update?.let { "update" to it.toString() },
+            additionalPackages?.let { "additional-packages" to it.joinToString(" ") },
+            wslShellUser?.let { "wsl-shell-user" to it },
+            wslShellCommand?.let { "wsl-shell-command" to it },
+            *_customInputs.toList().toTypedArray(),
+        ).toTypedArray()
+    )
+
+    public override fun buildOutputObject(stepId: String) = Outputs(stepId)
+
+    public sealed class Distribution(
+        public val stringValue: String,
+    ) {
+        public object Alpine : SetupWslV1.Distribution("Alpine")
+
+        public object Debian : SetupWslV1.Distribution("Debian")
+
+        public object KaliLinux : SetupWslV1.Distribution("kali-linux")
+
+        public object OpenSUSELeap152 : SetupWslV1.Distribution("openSUSE-Leap-15.2")
+
+        public object Ubuntu2004 : SetupWslV1.Distribution("Ubuntu-20.04")
+
+        public object Ubuntu1804 : SetupWslV1.Distribution("Ubuntu-18.04")
+
+        public object Ubuntu1604 : SetupWslV1.Distribution("Ubuntu-16.04")
+
+        public class Custom(
+            customStringValue: String,
+        ) : SetupWslV1.Distribution(customStringValue)
+    }
+
+    public class Outputs(
+        private val stepId: String,
+    ) {
+        /**
+         * The path to the wsl-shell wrapper that is generated by the current action invocation.
+         * Even if the current action invocation does not actually generate the script, because
+         * wsl-shell-command is not set explicitly and the script already exists, this output will
+         * be set.
+         */
+        public val wslShellWrapperPath: String = "steps.$stepId.outputs.wsl-shell-wrapper-path"
+
+        /**
+         * The path to the distribution-specific wsl-shell wrapper that is generated by the current
+         * action invocation.
+         * Even if the current action invocation does not actually generate the script, because
+         * wsl-shell-command is not set explicitly and the script already exists, this output will
+         * be set.
+         */
+        public val wslShellDistributionWrapperPath: String =
+            "steps.$stepId.outputs.wsl-shell-distribution-wrapper-path"
+
+        public operator fun `get`(outputName: String) = "steps.$stepId.outputs.$outputName"
+    }
+}
diff --git a/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/WrappersToGenerate.kt b/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/WrappersToGenerate.kt
index c69edad86b..fa84d4efc9 100644
--- a/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/WrappersToGenerate.kt
+++ b/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/WrappersToGenerate.kt
@@ -871,6 +871,30 @@ val wrappersToGenerate = listOf(
             "mongodb-port" to IntegerTyping,
         )
     ),
+    WrapperRequest(
+        ActionCoords("Vampire", "setup-wsl", "v1"),
+        mapOf(
+            "distribution" to EnumTyping(
+                "Distribution",
+                listOf(
+                    "Alpine",
+                    "Debian",
+                    "kali-linux",
+                    "openSUSE-Leap-15.2",
+                    "Ubuntu-20.04",
+                    "Ubuntu-18.04",
+                    "Ubuntu-16.04"
+                )
+            ),
+            "use-cache" to BooleanTyping,
+            "wsl-conf" to StringTyping,
+            "set-as-default" to BooleanTyping,
+            "update" to BooleanTyping,
+            "additional-packages" to ListOfTypings(" "),
+            "wsl-shell-user" to StringTyping,
+            "wsl-shell-command" to StringTyping,
+        )
+    ),
     WrapperRequest(
         ActionCoords("w9jds", "firebase-action", "v2.2.2"),
     ),
diff --git a/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformation.kt b/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformation.kt
index 7a64f1b1b8..2b4bc8b9d0 100644
--- a/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformation.kt
+++ b/wrapper-generator/src/main/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformation.kt
@@ -10,7 +10,7 @@ fun String.toPascalCase(): String {
     val hasOnlyUppercases = none { it in 'a'..'z' }
     val normalizedString = if (hasOnlyUppercases) lowercase() else this
     return normalizedString.replace("+", "-plus-")
-        .split("-", "_", " ")
+        .split("-", "_", " ", ".")
         .joinToString("") {
             it.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }
         }


Test patch:
diff --git a/wrapper-generator/src/test/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformationTest.kt b/wrapper-generator/src/test/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformationTest.kt
index 78f6fc2316..24d5f05870 100644
--- a/wrapper-generator/src/test/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformationTest.kt
+++ b/wrapper-generator/src/test/kotlin/it/krzeminski/githubactions/wrappergenerator/generation/TextTransformationTest.kt
@@ -22,6 +22,7 @@ class TextTransformationTest : FunSpec({
             "SOME_PROPERTY" to "SomeProperty",
             "some+name" to "SomePlusName",
             "some name with spaces" to "SomeNameWithSpaces",
+            "some.name.with.dots" to "SomeNameWithDots",
         ).forEach { (input, output) ->
             test("should convert '$input' to '$output'") {
                 input.toPascalCase() shouldBe output