Skip to content

Commit 2dc49e2

Browse files
committed
Works in tests?
1 parent 414e1e5 commit 2dc49e2

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,6 @@ internal fun WorkflowBuilder.consistencyCheckJob(
108108

109109
private fun inferCheckoutActionVersionFromClasspath(): String {
110110
val clazz = Class.forName("io.github.typesafegithub.workflows.actions.actions.Checkout")
111-
println("Constructors!")
112-
clazz.declaredConstructors.forEach {
113-
println(it)
114-
}
115-
// TODO: how to call the constructor with default args?
116-
// Or: how to get the version?
117-
val instance = clazz.declaredConstructors.first().newInstance()
118-
val version = clazz.getDeclaredMethod("getVersion").invoke(instance)
119-
return version as String
111+
val jarName = clazz.protectionDomain.codeSource.location.toString().substringAfterLast("/")
112+
return jarName.substringAfterLast("-").substringBeforeLast(".")
120113
}

0 commit comments

Comments
 (0)