Skip to content

Commit

Permalink
chore(dsl)!: remove leftover API for client-side bindings generation (#…
Browse files Browse the repository at this point in the history
…1422)

Client-side bindings generation was removed in favor of Maven-based
bindings hosted remotely.
  • Loading branch information
krzema12 committed Apr 25, 2024
1 parent 97ba268 commit 088fd3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
8 changes: 4 additions & 4 deletions github-workflows-kt/api/github-workflows-kt.api
Expand Up @@ -3148,10 +3148,10 @@ public final class io/github/typesafegithub/workflows/yaml/Preamble$WithOriginal
}

public final class io/github/typesafegithub/workflows/yaml/ToYamlKt {
public static final fun toYaml (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;Z)Ljava/lang/String;
public static synthetic fun toYaml$default (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;ZILjava/lang/Object;)Ljava/lang/String;
public static final fun writeToFile (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;ZLkotlin/jvm/functions/Function1;)V
public static synthetic fun writeToFile$default (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public static final fun toYaml (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;)Ljava/lang/String;
public static synthetic fun toYaml$default (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;ILjava/lang/Object;)Ljava/lang/String;
public static final fun writeToFile (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun writeToFile$default (Lio/github/typesafegithub/workflows/domain/Workflow;ZLjava/nio/file/Path;Lio/github/typesafegithub/workflows/yaml/Preamble;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
}

public final class io/github/typesafegithub/workflows/yaml/TriggersToYamlKt {
Expand Down
Expand Up @@ -18,7 +18,6 @@ import io.github.typesafegithub.workflows.yaml.Preamble.WithOriginalBefore
import kotlinx.serialization.json.Json
import java.nio.file.Path
import kotlin.io.path.absolute
import kotlin.io.path.exists
import kotlin.io.path.invariantSeparatorsPathString

/**
Expand All @@ -40,7 +39,6 @@ public fun Workflow.toYaml(
addConsistencyCheck: Boolean = sourceFile != null,
gitRootDir: Path? = sourceFile?.absolute()?.findGitRoot(),
preamble: Preamble? = null,
generateActionBindings: Boolean = false,
): String {
require(this.jobs.all { it.steps.none { it is KotlinLogicStep } }) {
"toYaml() currently doesn't support steps with Kotlin-based 'run' blocks!"
Expand All @@ -51,7 +49,6 @@ public fun Workflow.toYaml(
useGitDiff = false,
gitRootDir = gitRootDir,
preamble,
generateActionBindings = generateActionBindings,
)
}

Expand All @@ -73,7 +70,6 @@ public fun Workflow.writeToFile(
addConsistencyCheck: Boolean = sourceFile != null,
gitRootDir: Path? = sourceFile?.absolute()?.findGitRoot(),
preamble: Preamble? = null,
generateActionBindings: Boolean = false,
getenv: (String) -> String? = { System.getenv(it) },
) {
val runStepEnvVar = getenv("GHWKT_RUN_STEP")
Expand Down Expand Up @@ -104,7 +100,6 @@ public fun Workflow.writeToFile(
useGitDiff = true,
gitRootDir = gitRootDir,
preamble,
generateActionBindings = generateActionBindings,
)

gitRootDir.resolve(".github").resolve("workflows").resolve(targetFileName).toFile().let {
Expand All @@ -131,15 +126,12 @@ private fun commentify(preamble: String): String {
.joinToString("\n", postfix = "\n\n") { "# $it".trimEnd() }
}

private const val GENERATE_ACTION_BINDINGS_SCRIPT_NAME = "generate-action-bindings.main.kts"

@Suppress("LongMethod")
private fun Workflow.generateYaml(
addConsistencyCheck: Boolean,
useGitDiff: Boolean,
gitRootDir: Path?,
preamble: Preamble?,
generateActionBindings: Boolean,
): String {
val sourceFilePath =
gitRootDir?.let {
Expand Down Expand Up @@ -174,15 +166,6 @@ private fun Workflow.generateYaml(
block()
}

if (generateActionBindings &&
sourceFile.parent?.resolve(GENERATE_ACTION_BINDINGS_SCRIPT_NAME)?.exists() == true
) {
run(
name = "Generate action bindings",
command = ".github/workflows/$GENERATE_ACTION_BINDINGS_SCRIPT_NAME \"$targetFileName\"",
)
}

if (useGitDiff) {
run(
name = "Execute script",
Expand Down

0 comments on commit 088fd3d

Please sign in to comment.