Skip to content

Commit badc797

Browse files
authored
feat(server): log requests for metadata (#1909)
1 parent 2fafb86 commit badc797

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

action-binding-generator/api/action-binding-generator.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public final class io/github/typesafegithub/workflows/actionbindinggenerator/dom
2121
public final class io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoordsKt {
2222
public static final fun getFullName (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Ljava/lang/String;
2323
public static final fun getPrettyPrint (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Ljava/lang/String;
24+
public static final fun getPrettyPrintWithoutVersion (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Ljava/lang/String;
2425
public static final fun getSubName (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Ljava/lang/String;
2526
public static final fun isTopLevel (Lio/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords;)Z
2627
}

action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/domain/ActionCoords.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ public data class ActionCoords(
2323
*/
2424
public val ActionCoords.isTopLevel: Boolean get() = path == null
2525

26-
public val ActionCoords.prettyPrint: String get() = "$owner/$fullName${
26+
public val ActionCoords.prettyPrint: String get() = "$prettyPrintWithoutVersion@$version"
27+
28+
public val ActionCoords.prettyPrintWithoutVersion: String get() = "$owner/$fullName${
2729
significantVersion.takeUnless { it == FULL }?.let { " with $it version" } ?: ""
28-
}@$version"
30+
}"
2931

3032
/**
3133
* For most actions, it's empty.

jit-binding-server/src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver/MetadataRoutes.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.github.typesafegithub.workflows.jitbindingserver
22

3+
import io.github.oshai.kotlinlogging.KotlinLogging.logger
4+
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.prettyPrintWithoutVersion
35
import io.github.typesafegithub.workflows.mavenbinding.buildPackageArtifacts
46
import io.github.typesafegithub.workflows.shared.internal.getGithubAuthToken
57
import io.ktor.http.HttpStatusCode
@@ -9,6 +11,8 @@ import io.ktor.server.routing.Routing
911
import io.ktor.server.routing.get
1012
import io.ktor.server.routing.route
1113

14+
private val logger = logger { }
15+
1216
fun Routing.metadataRoutes() {
1317
route("{owner}/{name}/{file}") {
1418
metadata()
@@ -26,6 +30,8 @@ private fun Route.metadata(refresh: Boolean = false) {
2630
val file = call.parameters["file"] ?: return@get call.respondNotFound()
2731
val actionCoords = call.parameters.extractActionCoords(extractVersion = false)
2832

33+
logger.info { "➡️ Requesting metadata for ${actionCoords.prettyPrintWithoutVersion}" }
34+
2935
val bindingArtifacts = actionCoords.buildPackageArtifacts(githubAuthToken = getGithubAuthToken())
3036
if (file in bindingArtifacts) {
3137
when (val artifact = bindingArtifacts[file]) {

0 commit comments

Comments
 (0)