File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
composeApp/src/commonMain/kotlin Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11import com.charleskorn.kaml.Yaml
22import io.ktor.client.call.body
33import io.ktor.client.request.get
4+ import io.ktor.http.HttpStatusCode
45import kotlinx.serialization.decodeFromString
56
67suspend fun fetchManifest (actionCoords : String ): Metadata ? {
7- val yaml = client.get(urlString = " https://raw.githubusercontent.com/${actionCoords.replace(" @" , " /" )} /action.yml" )
8- .body<String >()
8+ val yaml = listOf (" yml" , " yaml" ).firstNotNullOfOrNull { extension ->
9+ val response = client
10+ .get(urlString = " https://raw.githubusercontent.com/${actionCoords.replace(" @" , " /" )} /action.$extension " )
11+ if (response.status == HttpStatusCode .OK ) {
12+ response.body<String >()
13+ } else {
14+ null
15+ }
16+ } ? : return null
17+
918 return try {
1019 myYaml.decodeFromString<Metadata >(yaml)
1120 } catch (e: Exception ) {
You can’t perform that action at this time.
0 commit comments