Skip to content

Commit 23e01cd

Browse files
authored
chore(server): fetch typings from catalog only from lowercased owner/name (#2029)
Part of #2025. This is just cleanup and removing excess calls that don't make sense anymore.
1 parent 1444c31 commit 23e01cd

File tree

1 file changed

+4
-12
lines changed
  • action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing

1 file changed

+4
-12
lines changed

action-binding-generator/src/main/kotlin/io/github/typesafegithub/workflows/actionbindinggenerator/typing/TypesProviding.kt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,15 @@ private fun ActionCoords.actionTypesYmlUrl(gitRef: String) =
4242

4343
private fun ActionCoords.actionTypesFromCatalog() =
4444
"https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" +
45-
"main/typings/$owner/$name/$version$subName/action-types.yml"
45+
"main/typings/${owner.lowercase()}/${name.lowercase()}/$version$subName/action-types.yml"
4646

4747
private fun ActionCoords.catalogMetadata() =
4848
"https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" +
49-
"main/typings/$owner/$name/metadata.yml"
49+
"main/typings/${owner.lowercase()}/${name.lowercase()}/metadata.yml"
5050

5151
private fun ActionCoords.actionTypesYamlUrl(gitRef: String) =
5252
"https://raw.githubusercontent.com/$owner/$name/$gitRef$subName/action-types.yaml"
5353

54-
private fun ActionCoords.nameAndOwnerToLowerCase() =
55-
this.copy(
56-
owner = this.owner.lowercase(),
57-
name = this.name.lowercase(),
58-
)
59-
6054
private fun ActionCoords.fetchTypingMetadata(
6155
metadataRevision: MetadataRevision,
6256
fetchUri: (URI) -> String = ::fetchUri,
@@ -85,10 +79,8 @@ private fun ActionCoords.fetchFromTypingsFromCatalog(
8579
fetchUri: (URI) -> String = ::fetchUri,
8680
): Pair<ActionTypes, TypingActualSource>? =
8781
(
88-
fetchTypingsFromUrl(url = actionTypesFromCatalog(), fetchUri = fetchUri)
89-
?: fetchTypingsFromUrl(url = this.nameAndOwnerToLowerCase().actionTypesFromCatalog(), fetchUri = fetchUri)
90-
?: fetchTypingsForOlderVersionFromCatalog(fetchUri = fetchUri)
91-
?: this.nameAndOwnerToLowerCase().fetchTypingsForOlderVersionFromCatalog(fetchUri = fetchUri)
82+
fetchTypingsFromUrl(url = this.actionTypesFromCatalog(), fetchUri = fetchUri)
83+
?: this.fetchTypingsForOlderVersionFromCatalog(fetchUri = fetchUri)
9284
)?.let { Pair(it, TYPING_CATALOG) }
9385

9486
private fun ActionCoords.fetchTypingsForOlderVersionFromCatalog(fetchUri: (URI) -> String): ActionTypes? {

0 commit comments

Comments
 (0)