Skip to content

Commit 539c5d6

Browse files
authored
refactor: extract base URL for the typings catalog (#2031)
A simple deduplicating refactor.
1 parent 23e01cd commit 539c5d6

File tree

1 file changed

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

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ internal fun ActionCoords.provideTypes(
4040
private fun ActionCoords.actionTypesYmlUrl(gitRef: String) =
4141
"https://raw.githubusercontent.com/$owner/$name/$gitRef$subName/action-types.yml"
4242

43-
private fun ActionCoords.actionTypesFromCatalog() =
44-
"https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" +
45-
"main/typings/${owner.lowercase()}/${name.lowercase()}/$version$subName/action-types.yml"
46-
47-
private fun ActionCoords.catalogMetadata() =
48-
"https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/" +
49-
"main/typings/${owner.lowercase()}/${name.lowercase()}/metadata.yml"
50-
5143
private fun ActionCoords.actionTypesYamlUrl(gitRef: String) =
5244
"https://raw.githubusercontent.com/$owner/$name/$gitRef$subName/action-types.yaml"
5345

46+
private const val CATALOG_BASE_URL =
47+
"https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/main/typings"
48+
49+
private fun ActionCoords.actionTypesFromCatalog() =
50+
"$CATALOG_BASE_URL/${owner.lowercase()}/${name.lowercase()}/$version$subName/action-types.yml"
51+
52+
private fun ActionCoords.catalogMetadata() = "$CATALOG_BASE_URL/${owner.lowercase()}/${name.lowercase()}/metadata.yml"
53+
5454
private fun ActionCoords.fetchTypingMetadata(
5555
metadataRevision: MetadataRevision,
5656
fetchUri: (URI) -> String = ::fetchUri,

0 commit comments

Comments
 (0)