Skip to content

Commit 0301fd0

Browse files
committed
Add coment about a hack
1 parent 3d6981a commit 0301fd0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

github-workflows-kt/src/main/kotlin/io/github/typesafegithub/workflows/yaml/ConsistencyCheckJob.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ internal fun WorkflowBuilder.consistencyCheckJob(
109109

110110
private fun inferCheckoutActionVersionFromClasspath(): String {
111111
val clazz = Class.forName("io.github.typesafegithub.workflows.actions.actions.Checkout")
112+
// HACK: Ideally we'd instantiate the binding class and ask it for version, however
113+
// it turned out to be difficult due to default arguments in Kotlin. Using Java's
114+
// reflection, the constructors require passing ~40 arguments. As a workaround,
115+
// the version is extracted from JAR's name, like: 'checkout-v4.jar' -> 'v4'.
112116
val jarName =
113117
clazz.protectionDomain.codeSource.location
114118
.toString()

0 commit comments

Comments
 (0)