Repository: typesafegithub/github-workflows-kt
Pull request #1023 (2023-10-14 19:21:35)

[#941] refactor: inline metadata-reading module
Another step towards making action-binding-generator a deployable library.


Patch:
diff --git a/automation/action-binding-generator/api/action-binding-generator.api b/automation/action-binding-generator/api/action-binding-generator.api
index 6a7ab614d..0f853e22a 100644
--- a/automation/action-binding-generator/api/action-binding-generator.api
+++ b/automation/action-binding-generator/api/action-binding-generator.api
@@ -16,8 +16,116 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/Act
 }
 
 public final class io/github/typesafegithub/workflows/actionbindinggenerator/GenerationKt {
-	public static final fun generateBinding (Lio/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Ljava/util/Map;)Lio/github/typesafegithub/workflows/actionbindinggenerator/ActionBinding;
-	public static synthetic fun generateBinding$default (Lio/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/ActionBinding;
+	public static final fun generateBinding (Lio/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords;Ljava/lang/String;ZLio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;Ljava/util/Map;)Lio/github/typesafegithub/workflows/actionbindinggenerator/ActionBinding;
+	public static synthetic fun generateBinding$default (Lio/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords;Ljava/lang/String;ZLio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;Ljava/util/Map;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/ActionBinding;
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Input {
+	public static final field Companion Lio/github/typesafegithub/workflows/actionbindinggenerator/Input$Companion;
+	public fun <init> ()V
+	public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
+	public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;)V
+	public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+	public final fun component1 ()Ljava/lang/String;
+	public final fun component2 ()Ljava/lang/String;
+	public final fun component3 ()Ljava/lang/Boolean;
+	public final fun component4 ()Ljava/lang/String;
+	public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Input;
+	public static synthetic fun copy$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/Input;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Input;
+	public fun equals (Ljava/lang/Object;)Z
+	public final fun getDefault ()Ljava/lang/String;
+	public final fun getDeprecationMessage ()Ljava/lang/String;
+	public final fun getDescription ()Ljava/lang/String;
+	public final fun getRequired ()Ljava/lang/Boolean;
+	public fun hashCode ()I
+	public fun toString ()Ljava/lang/String;
+	public static final synthetic fun write$Self (Lio/github/typesafegithub/workflows/actionbindinggenerator/Input;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Input$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+	public static final field INSTANCE Lio/github/typesafegithub/workflows/actionbindinggenerator/Input$$serializer;
+	public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+	public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Input;
+	public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+	public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+	public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lio/github/typesafegithub/workflows/actionbindinggenerator/Input;)V
+	public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+	public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Input$Companion {
+	public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Metadata {
+	public static final field Companion Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata$Companion;
+	public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
+	public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;)V
+	public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+	public final fun component1 ()Ljava/lang/String;
+	public final fun component2 ()Ljava/lang/String;
+	public final fun component3 ()Ljava/util/Map;
+	public final fun component4 ()Ljava/util/Map;
+	public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;
+	public static synthetic fun copy$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;
+	public fun equals (Ljava/lang/Object;)Z
+	public final fun getDescription ()Ljava/lang/String;
+	public final fun getInputs ()Ljava/util/Map;
+	public final fun getName ()Ljava/lang/String;
+	public final fun getOutputs ()Ljava/util/Map;
+	public fun hashCode ()I
+	public fun toString ()Ljava/lang/String;
+	public static final synthetic fun write$Self (Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Metadata$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+	public static final field INSTANCE Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata$$serializer;
+	public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+	public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;
+	public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+	public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+	public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lio/github/typesafegithub/workflows/actionbindinggenerator/Metadata;)V
+	public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+	public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Metadata$Companion {
+	public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/MetadataReadingKt {
+	public static final fun deleteActionYamlCacheIfObsolete ()V
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Output {
+	public static final field Companion Lio/github/typesafegithub/workflows/actionbindinggenerator/Output$Companion;
+	public fun <init> ()V
+	public synthetic fun <init> (ILjava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
+	public fun <init> (Ljava/lang/String;)V
+	public synthetic fun <init> (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+	public final fun component1 ()Ljava/lang/String;
+	public final fun copy (Ljava/lang/String;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Output;
+	public static synthetic fun copy$default (Lio/github/typesafegithub/workflows/actionbindinggenerator/Output;Ljava/lang/String;ILjava/lang/Object;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Output;
+	public fun equals (Ljava/lang/Object;)Z
+	public final fun getDescription ()Ljava/lang/String;
+	public fun hashCode ()I
+	public fun toString ()Ljava/lang/String;
+	public static final synthetic fun write$Self (Lio/github/typesafegithub/workflows/actionbindinggenerator/Output;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Output$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+	public static final field INSTANCE Lio/github/typesafegithub/workflows/actionbindinggenerator/Output$$serializer;
+	public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+	public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lio/github/typesafegithub/workflows/actionbindinggenerator/Output;
+	public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+	public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+	public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lio/github/typesafegithub/workflows/actionbindinggenerator/Output;)V
+	public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+	public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class io/github/typesafegithub/workflows/actionbindinggenerator/Output$Companion {
+	public final fun serializer ()Lkotlinx/serialization/KSerializer;
 }
 
 public final class io/github/typesafegithub/workflows/actionbindinggenerator/TypesProvidingKt {
diff --git a/automation/action-binding-generator/build.gradle.kts b/automation/action-binding-generator/build.gradle.kts
index 01d0e2a2d..0d21db3a5 100644
--- a/automation/action-binding-generator/build.gradle.kts
+++ b/automation/action-binding-generator/build.gradle.kts
@@ -2,13 +2,13 @@ import org.jmailen.gradle.kotlinter.tasks.ConfigurableKtLintTask
 
 plugins {
     buildsrc.convention.`kotlin-jvm`
+    kotlin("plugin.serialization")
 
     id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
 }
 
 dependencies {
     implementation(projects.automation.typings)
-    implementation(projects.automation.metadataReading)
     implementation(projects.automation.textUtils)
     implementation("com.squareup:kotlinpoet:1.14.2")
     implementation("com.charleskorn.kaml:kaml:0.55.0")
diff --git a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Generation.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Generation.kt
index 6a8978327..70e7a203b 100644
--- a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Generation.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/Generation.kt
@@ -19,10 +19,6 @@ import io.github.typesafegithub.workflows.actionbindinggenerator.Properties.CUST
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionCoords
 import io.github.typesafegithub.workflows.actionsmetadata.model.StringTyping
 import io.github.typesafegithub.workflows.actionsmetadata.model.Typing
-import io.github.typesafegithub.workflows.metadatareading.Input
-import io.github.typesafegithub.workflows.metadatareading.Metadata
-import io.github.typesafegithub.workflows.metadatareading.fetchMetadata
-import io.github.typesafegithub.workflows.metadatareading.prettyPrint
 import io.github.typesafegithub.workflows.textutils.toCamelCase
 import java.nio.file.Path
 
@@ -46,22 +42,26 @@ private object Properties {
 }
 
 public fun ActionCoords.generateBinding(
-    fetchMetadataImpl: ActionCoords.() -> Metadata = { fetchMetadata() },
     commitHash: String? = getCommitHashFromFileSystem(),
+    useCache: Boolean = true,
+    metadata: Metadata =
+        commitHash?.let {
+            this.fetchMetadata(commitHash = it, useCache = useCache)
+        } ?: this.fetchMetadata(useCache = useCache),
     inputTypings: Map<String, Typing> = provideTypes(getCommitHash = { commitHash }),
 ): ActionBinding {
     require(this.version.removePrefix("v").toIntOrNull() != null) {
         "Only major versions are supported, and '${this.version}' was given!"
     }
 
-    val metadata = fetchMetadataImpl().removeDeprecatedInputsIfNameClash()
-    checkPropertiesAreValid(metadata, inputTypings)
-    metadata.suggestAdditionalTypings(inputTypings.keys)?.let { formatSuggestions ->
+    val metadataProcessed = metadata.removeDeprecatedInputsIfNameClash()
+    checkPropertiesAreValid(metadataProcessed, inputTypings)
+    metadataProcessed.suggestAdditionalTypings(inputTypings.keys)?.let { formatSuggestions ->
         println("$prettyPrint I suggest the following typings:\n$formatSuggestions")
     }
 
     val className = this.buildActionClassName()
-    val actionBindingSourceCode = generateActionBindingSourceCode(metadata, this, inputTypings, className)
+    val actionBindingSourceCode = generateActionBindingSourceCode(metadataProcessed, this, inputTypings, className)
     val packageName = owner.toKotlinPackageName()
     return ActionBinding(
         kotlinCode = actionBindingSourceCode,
diff --git a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullability.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullability.kt
index dccdbe381..88a64c1f7 100644
--- a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullability.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullability.kt
@@ -1,7 +1,5 @@
 package io.github.typesafegithub.workflows.actionbindinggenerator
 
-import io.github.typesafegithub.workflows.metadatareading.Input
-
 /**
  * [Input.required] is in theory a required field in action's metadata, but in practice a lot of actions don't specify
  * it. It's thus a challenge to infer nullability of inputs in the Kotlin bindings. This function tackles this task.
diff --git a/automation/metadata-reading/src/main/kotlin/io/github/typesafegithub/workflows/metadatareading/MetadataReading.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/MetadataReading.kt
similarity index 85%
rename from automation/metadata-reading/src/main/kotlin/io/github/typesafegithub/workflows/metadatareading/MetadataReading.kt
rename to automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/MetadataReading.kt
index 1c9227288..45da19695 100644
--- a/automation/metadata-reading/src/main/kotlin/io/github/typesafegithub/workflows/metadatareading/MetadataReading.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/MetadataReading.kt
@@ -1,4 +1,4 @@
-package io.github.typesafegithub.workflows.metadatareading
+package io.github.typesafegithub.workflows.actionbindinggenerator
 
 import com.charleskorn.kaml.Yaml
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionCoords
@@ -15,7 +15,7 @@ import java.time.LocalDate
  */
 
 @Serializable
-data class Metadata(
+public data class Metadata(
     val name: String,
     val description: String,
     val inputs: Map<String, Input> = emptyMap(),
@@ -23,7 +23,7 @@ data class Metadata(
 )
 
 @Serializable
-data class Input(
+public data class Input(
     val description: String = "",
     val default: String? = null,
     val required: Boolean? = null,
@@ -31,7 +31,7 @@ data class Input(
 )
 
 @Serializable
-data class Output(
+public data class Output(
     val description: String = "",
 )
 
@@ -45,13 +45,13 @@ private fun ActionCoords.actionYamlUrl(gitRef: String) =
         '/',
     )}/$gitRef/${if ("/" in name) "${name.substringAfter('/')}/" else ""}action.yaml"
 
-val ActionCoords.releasesUrl: String get() = "$gitHubUrl/releases"
+internal val ActionCoords.releasesUrl: String get() = "$gitHubUrl/releases"
 
-val ActionCoords.gitHubUrl: String get() = "https://github.com/$owner/$name"
+internal val ActionCoords.gitHubUrl: String get() = "https://github.com/$owner/$name"
 
-val ActionCoords.prettyPrint: String get() = "$owner/$name@$version"
+internal val ActionCoords.prettyPrint: String get() = "$owner/$name@$version"
 
-fun ActionCoords.fetchMetadata(
+internal fun ActionCoords.fetchMetadata(
     commitHash: String = getCommitHashFromFileSystem(),
     useCache: Boolean = true,
     fetchUri: (URI) -> String = ::fetchUri,
@@ -89,7 +89,7 @@ fun ActionCoords.fetchMetadata(
 private fun ActionCoords.getCommitHashFromFileSystem(): String =
     Path.of("actions", owner, name.substringBefore('/'), version, "commit-hash.txt").toFile().readText().trim()
 
-fun fetchUri(uri: URI): String = uri.toURL().readText()
+internal fun fetchUri(uri: URI): String = uri.toURL().readText()
 
 private val myYaml =
     Yaml(
@@ -101,7 +101,7 @@ private val myYaml =
 
 private val actionYamlDir: File = File("build/action-yaml")
 
-fun deleteActionYamlCacheIfObsolete() {
+public fun deleteActionYamlCacheIfObsolete() {
     val today = LocalDate.now().toString()
     val dateTxt = actionYamlDir.resolve("date.txt")
     val cacheUpToDate = dateTxt.canRead() && dateTxt.readText() == today
diff --git a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypesProviding.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypesProviding.kt
index 6e6358e01..8462b1494 100644
--- a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypesProviding.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypesProviding.kt
@@ -13,7 +13,6 @@ import io.github.typesafegithub.workflows.actionsmetadata.model.IntegerWithSpeci
 import io.github.typesafegithub.workflows.actionsmetadata.model.ListOfTypings
 import io.github.typesafegithub.workflows.actionsmetadata.model.StringTyping
 import io.github.typesafegithub.workflows.actionsmetadata.model.Typing
-import io.github.typesafegithub.workflows.metadatareading.fetchUri
 import io.github.typesafegithub.workflows.textutils.toPascalCase
 import kotlinx.serialization.decodeFromString
 import java.io.File
diff --git a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestions.kt b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestions.kt
index 7d269aa41..9d52daf19 100644
--- a/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestions.kt
+++ b/automation/action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestions.kt
@@ -1,8 +1,5 @@
 package io.github.typesafegithub.workflows.actionbindinggenerator
 
-import io.github.typesafegithub.workflows.metadatareading.Input
-import io.github.typesafegithub.workflows.metadatareading.Metadata
-
 internal fun Metadata.suggestAdditionalTypings(existingTypings: Set<String>): String? {
     val keys =
         (inputs.keys - existingTypings).associate {
diff --git a/automation/code-generator/build.gradle.kts b/automation/code-generator/build.gradle.kts
index 9e300cb04..11a6a6537 100644
--- a/automation/code-generator/build.gradle.kts
+++ b/automation/code-generator/build.gradle.kts
@@ -18,7 +18,6 @@ dependencies {
 
     implementation(projects.automation.typings)
     implementation(projects.automation.actionBindingGenerator)
-    implementation(projects.automation.metadataReading)
     implementation(projects.automation.textUtils)
 
     testImplementation(projects.library)
diff --git a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/GenerationEntryPoint.kt b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/GenerationEntryPoint.kt
index 12272240f..b05c0fbec 100644
--- a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/GenerationEntryPoint.kt
+++ b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/GenerationEntryPoint.kt
@@ -2,15 +2,15 @@ package io.github.typesafegithub.workflows.codegenerator
 
 import io.github.typesafegithub.workflows.actionbindinggenerator.ActionBinding
 import io.github.typesafegithub.workflows.actionbindinggenerator.deleteActionTypesYamlCacheIfObsolete
+import io.github.typesafegithub.workflows.actionbindinggenerator.deleteActionYamlCacheIfObsolete
 import io.github.typesafegithub.workflows.actionbindinggenerator.generateBinding
 import io.github.typesafegithub.workflows.actionsmetadata.bindingsToGenerate
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionBindingRequest
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionCoords
 import io.github.typesafegithub.workflows.actionsmetadata.model.TypingsSource
 import io.github.typesafegithub.workflows.actionsmetadata.model.Version
+import io.github.typesafegithub.workflows.actionsmetadata.model.prettyPrint
 import io.github.typesafegithub.workflows.dsl.expressions.generateEventPayloads
-import io.github.typesafegithub.workflows.metadatareading.deleteActionYamlCacheIfObsolete
-import io.github.typesafegithub.workflows.metadatareading.prettyPrint
 import java.nio.file.Path
 import java.nio.file.Paths
 
diff --git a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/updating/CreateActionUpdatePRs.kt b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/updating/CreateActionUpdatePRs.kt
index 6d520cce6..de11b465c 100644
--- a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/updating/CreateActionUpdatePRs.kt
+++ b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/updating/CreateActionUpdatePRs.kt
@@ -6,13 +6,12 @@ import io.github.typesafegithub.workflows.actionsmetadata.bindingsToGenerate
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionBindingRequest
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionCoords
 import io.github.typesafegithub.workflows.actionsmetadata.model.isTopLevel
+import io.github.typesafegithub.workflows.actionsmetadata.model.prettyPrint
 import io.github.typesafegithub.workflows.codegenerator.versions.GithubRef
 import io.github.typesafegithub.workflows.codegenerator.versions.GithubTag
 import io.github.typesafegithub.workflows.codegenerator.versions.getGithubToken
 import io.github.typesafegithub.workflows.codegenerator.versions.httpClient
 import io.github.typesafegithub.workflows.codegenerator.versions.json
-import io.github.typesafegithub.workflows.metadatareading.fetchMetadata
-import io.github.typesafegithub.workflows.metadatareading.prettyPrint
 import io.ktor.client.request.bearerAuth
 import io.ktor.client.request.get
 import io.ktor.client.statement.bodyAsText
@@ -81,7 +80,7 @@ private suspend fun createPullRequest(
 private fun ActionBindingRequest.generateBindingForCommit(commitHash: String): ActionBinding =
     actionCoords.generateBinding(
         commitHash = commitHash,
-        fetchMetadataImpl = { fetchMetadata(commitHash = commitHash, useCache = false) },
+        useCache = false,
     )
 
 private suspend fun ActionCoords.fetchCommitHash(githubToken: String): String? {
diff --git a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/versions/SuggestVersions.kt b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/versions/SuggestVersions.kt
index 02112a868..23a3bba47 100644
--- a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/versions/SuggestVersions.kt
+++ b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator/versions/SuggestVersions.kt
@@ -4,7 +4,7 @@ import io.github.typesafegithub.workflows.actionsmetadata.bindingsToGenerate
 import io.github.typesafegithub.workflows.actionsmetadata.model.ActionCoords
 import io.github.typesafegithub.workflows.actionsmetadata.model.Version
 import io.github.typesafegithub.workflows.actionsmetadata.model.isTopLevel
-import io.github.typesafegithub.workflows.metadatareading.prettyPrint
+import io.github.typesafegithub.workflows.actionsmetadata.model.prettyPrint
 import java.io.File
 
 /**
diff --git a/automation/typings/src/main/kotlin/io/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords.kt b/automation/typings/src/main/kotlin/io/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords.kt
index a5096def2..788989239 100644
--- a/automation/typings/src/main/kotlin/io/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords.kt
+++ b/automation/typings/src/main/kotlin/io/github/typesafegithub/workflows/actionsmetadata/model/ActionCoords.kt
@@ -13,4 +13,4 @@ data class ActionCoords(
  */
 val ActionCoords.isTopLevel: Boolean get() = "/" !in name
 
-internal val ActionCoords.prettyPrint: String get() = "$owner/$name@$version"
+val ActionCoords.prettyPrint: String get() = "$owner/$name@$version"
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 5e084f5a2..ba34c1607 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -7,7 +7,6 @@ include(
     ":automation:typings",
     ":automation:code-generator",
     ":automation:action-binding-generator",
-    ":automation:metadata-reading",
     ":automation:text-utils",
 )
 


Test patch:
diff --git a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GenerationTest.kt b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GenerationTest.kt
index c20f69a36..a64d9345b 100644
--- a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GenerationTest.kt
+++ b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/GenerationTest.kt
@@ -8,9 +8,6 @@ import io.github.typesafegithub.workflows.actionsmetadata.model.IntegerTyping
 import io.github.typesafegithub.workflows.actionsmetadata.model.IntegerWithSpecialValueTyping
 import io.github.typesafegithub.workflows.actionsmetadata.model.ListOfTypings
 import io.github.typesafegithub.workflows.actionsmetadata.model.StringTyping
-import io.github.typesafegithub.workflows.metadatareading.Input
-import io.github.typesafegithub.workflows.metadatareading.Metadata
-import io.github.typesafegithub.workflows.metadatareading.Output
 import io.kotest.assertions.throwables.shouldThrowAny
 import io.kotest.core.spec.style.FunSpec
 import io.kotest.matchers.throwable.shouldHaveMessage
@@ -50,7 +47,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "simple-action-with-required-string-inputs", "v3")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest })
+        val binding = coords.generateBinding(metadata = actionManifest)
 
         // then
         binding.shouldMatchFile("SimpleActionWithRequiredStringInputsV3.kt")
@@ -95,7 +92,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "action-with-some-optional-inputs", "v3")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest })
+        val binding = coords.generateBinding(metadata = actionManifest)
 
         // then
         binding.shouldMatchFile("ActionWithSomeOptionalInputsV3.kt")
@@ -170,7 +167,7 @@ class GenerationTest : FunSpec({
         // when
         val binding =
             coords.generateBinding(
-                fetchMetadataImpl = { actionManifest },
+                metadata = actionManifest,
                 inputTypings =
                     mapOf(
                         "baz-goo" to BooleanTyping,
@@ -212,7 +209,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "action-with-outputs", "v3")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest })
+        val binding = coords.generateBinding(metadata = actionManifest)
 
         // then
         binding.shouldMatchFile("ActionWithOutputsV3.kt")
@@ -241,7 +238,7 @@ class GenerationTest : FunSpec({
 
         shouldThrowAny {
             // when
-            coords.generateBinding(fetchMetadataImpl = { actionManifest }, inputTypings = inputTypings)
+            coords.generateBinding(metadata = actionManifest, inputTypings = inputTypings)
         }.shouldHaveMessage(
             // then
             """
@@ -265,7 +262,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "action-with-no-inputs", "v3")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest })
+        val binding = coords.generateBinding(metadata = actionManifest)
 
         // then
         binding.shouldMatchFile("ActionWithNoInputsV3.kt")
@@ -284,7 +281,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "deprecated-action", "v2", deprecatedByVersion = "v3")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest })
+        val binding = coords.generateBinding(metadata = actionManifest)
 
         // then
         binding.shouldMatchFile("DeprecatedActionV2.kt")
@@ -317,7 +314,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "action-with-deprecated-input-and-name-clash", "v2")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest })
+        val binding = coords.generateBinding(metadata = actionManifest)
 
         // then
         binding.shouldMatchFile("ActionWithDeprecatedInputAndNameClashV2.kt")
@@ -355,7 +352,7 @@ class GenerationTest : FunSpec({
         val coords = ActionCoords("john-smith", "simple-action-with-lists", "v3")
 
         // when
-        val binding = coords.generateBinding(fetchMetadataImpl = { actionManifest }, inputTypings = inputTypings)
+        val binding = coords.generateBinding(metadata = actionManifest, inputTypings = inputTypings)
 
         // then
         binding.shouldMatchFile("SimpleActionWithListsV3.kt")
@@ -391,7 +388,7 @@ class GenerationTest : FunSpec({
         // when
         val binding =
             coords.generateBinding(
-                fetchMetadataImpl = { actionManifest },
+                metadata = actionManifest,
                 inputTypings =
                     mapOf(
                         "foo-one" to IntegerWithSpecialValueTyping("Foo", mapOf("Special1" to 3)),
diff --git a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullabilityTest.kt b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullabilityTest.kt
index 6cfeef72a..c56d1bf6d 100644
--- a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullabilityTest.kt
+++ b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/InputNullabilityTest.kt
@@ -1,6 +1,5 @@
 package io.github.typesafegithub.workflows.actionbindinggenerator
 
-import io.github.typesafegithub.workflows.metadatareading.Input
 import io.kotest.core.spec.style.FunSpec
 import io.kotest.data.row
 import io.kotest.matchers.shouldBe
diff --git a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestionsTest.kt b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestionsTest.kt
index aec2539da..79399bca6 100644
--- a/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestionsTest.kt
+++ b/automation/action-binding-generator/src/test/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/TypingSuggestionsTest.kt
@@ -1,7 +1,5 @@
 package io.github.typesafegithub.workflows.actionbindinggenerator
 
-import io.github.typesafegithub.workflows.metadatareading.Input
-import io.github.typesafegithub.workflows.metadatareading.Metadata
 import io.kotest.core.spec.style.FunSpec
 import io.kotest.inspectors.forAll
 import io.kotest.matchers.shouldBe