Skip to content

Commit

Permalink
[#407] docs: mark actions providing typings (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzema12 committed Oct 28, 2022
1 parent 72951bc commit 6e90134
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
18 changes: 10 additions & 8 deletions docs/supported-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Click on a version to see the wrapper's code.
* entrostat
* [git-secret-action](https://github.com/entrostat/git-secret-action) - v3.3.0: [`GitSecretActionV3`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/entrostat/GitSecretActionV3.kt)
* ericcornelissen
* [git-tag-annotation-action](https://github.com/ericcornelissen/git-tag-annotation-action) - v2: [`GitTagAnnotationActionV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/ericcornelissen/GitTagAnnotationActionV2.kt)
* [git-tag-annotation-action](https://github.com/ericcornelissen/git-tag-annotation-action) - v2: [`GitTagAnnotationActionV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/ericcornelissen/GitTagAnnotationActionV2.kt)
* gautamkrishnar
* [blog-post-workflow](https://github.com/gautamkrishnar/blog-post-workflow) - v1: [`BlogPostWorkflowV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/gautamkrishnar/BlogPostWorkflowV1.kt)
* google-github-actions
Expand All @@ -95,13 +95,13 @@ Click on a version to see the wrapper's code.
* julia-actions
* [setup-julia](https://github.com/julia-actions/setup-julia) - v1: [`SetupJuliaV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/juliaactions/SetupJuliaV1.kt)
* krzema12
* [github-actions-typing](https://github.com/krzema12/github-actions-typing) - v0: [`GithubActionsTypingV0`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/krzema12/GithubActionsTypingV0.kt)
* [github-actions-typing](https://github.com/krzema12/github-actions-typing) - v0: [`GithubActionsTypingV0`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/krzema12/GithubActionsTypingV0.kt)
* madhead
* [check-gradle-version](https://github.com/madhead/check-gradle-version) - v1: [`CheckGradleVersionV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/madhead/CheckGradleVersionV1.kt)
* [read-java-properties](https://github.com/madhead/read-java-properties) - latest: [`ReadJavaProperties`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/madhead/ReadJavaProperties.kt)
* [semver-utils](https://github.com/madhead/semver-utils) - v2: [`SemverUtilsV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/madhead/SemverUtilsV2.kt)
* [check-gradle-version](https://github.com/madhead/check-gradle-version) - v1: [`CheckGradleVersionV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/madhead/CheckGradleVersionV1.kt)
* [read-java-properties](https://github.com/madhead/read-java-properties) - latest: [`ReadJavaProperties`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/madhead/ReadJavaProperties.kt)
* [semver-utils](https://github.com/madhead/semver-utils) - v2: [`SemverUtilsV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/madhead/SemverUtilsV2.kt)
* mi-kas
* [kover-report](https://github.com/mi-kas/kover-report) - v1: [`KoverReportV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/mikas/KoverReportV1.kt)
* [kover-report](https://github.com/mi-kas/kover-report) - v1: [`KoverReportV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/mikas/KoverReportV1.kt)
* microsoft
* [setup-msbuild](https://github.com/microsoft/setup-msbuild) - v1: [`SetupMsbuildV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/microsoft/SetupMsbuildV1.kt)
* nobrayner
Expand All @@ -115,7 +115,7 @@ Click on a version to see the wrapper's code.
* peterjgrainger
* [action-create-branch](https://github.com/peterjgrainger/action-create-branch) - v2.2.0: [`ActionCreateBranchV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/peterjgrainger/ActionCreateBranchV2.kt)
* ReactiveCircus
* [android-emulator-runner](https://github.com/ReactiveCircus/android-emulator-runner) - v2: [`AndroidEmulatorRunnerV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/reactivecircus/AndroidEmulatorRunnerV2.kt)
* [android-emulator-runner](https://github.com/ReactiveCircus/android-emulator-runner) - v2: [`AndroidEmulatorRunnerV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/reactivecircus/AndroidEmulatorRunnerV2.kt)
* repo-sync
* [pull-request](https://github.com/repo-sync/pull-request) - v2: [`PullRequestV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/reposync/PullRequestV2.kt)
* ruby
Expand All @@ -133,7 +133,7 @@ Click on a version to see the wrapper's code.
* supercharge
* [mongodb-github-action](https://github.com/supercharge/mongodb-github-action) - v1: [`MongodbGithubActionV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/supercharge/MongodbGithubActionV1.kt)
* Vampire
* [setup-wsl](https://github.com/Vampire/setup-wsl) - v1: [`SetupWslV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/vampire/SetupWslV1.kt)
* [setup-wsl](https://github.com/Vampire/setup-wsl) - v1: [`SetupWslV1`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/vampire/SetupWslV1.kt)
* w9jds
* [firebase-action](https://github.com/w9jds/firebase-action) - v2.2.2: [`FirebaseActionV2`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/w9jds/FirebaseActionV2.kt), v11.9.0: [`FirebaseActionV11`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/w9jds/FirebaseActionV11.kt)

Expand All @@ -143,3 +143,5 @@ Number of wrappers available:

* counting by actions: 81
* counting each version separately: 98

Actions [providing typings](https://github.com/krzema12/github-actions-typing/) (marked with ✅ on the above list): 8
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package it.krzeminski.githubactions.wrappergenerator

import it.krzeminski.githubactions.dsl.expressions.generateEventPayloads
import it.krzeminski.githubactions.wrappergenerator.domain.ActionCoords
import it.krzeminski.githubactions.wrappergenerator.domain.TypingsSource
import it.krzeminski.githubactions.wrappergenerator.domain.WrapperRequest
import it.krzeminski.githubactions.wrappergenerator.generation.buildActionClassName
import it.krzeminski.githubactions.wrappergenerator.generation.generateWrapper
import it.krzeminski.githubactions.wrappergenerator.generation.toKotlinPackageName
Expand Down Expand Up @@ -57,34 +59,45 @@ private fun generateListOfWrappersForDocs(listOfWrappersInDocs: Path) {
)

wrappersToGenerate
.map { it.actionCoords }
.groupBy { it.owner }
.groupBy { it.actionCoords.owner }
.forEach { (owner, ownedActions) ->
writer.println("* $owner")
ownedActions
.groupBy { it.name }
.groupBy { it.actionCoords.name }
.forEach { (_, versions) ->
val kotlinClasses = versions.sortedBy { Version(it.version) }.joinToString(", ") { it.toMarkdownLinkToKotlinCode() }
writer.println(" * ${versions.first().toMarkdownLinkGithub()} - $kotlinClasses")
val kotlinClasses = versions
.sortedBy { Version(it.actionCoords.version) }
.joinToString(", ") { it.toMarkdownLinkToKotlinCode() }
writer.println(" * ${versions.first().actionCoords.toMarkdownLinkGithub()} - $kotlinClasses")
}
}

val uniqueActionsCount = wrappersToGenerate.groupBy { "${it.actionCoords.owner}/${it.actionCoords.name}" }.size
val uniqueActionsProvidingTypingsCount = wrappersToGenerate
.groupBy { "${it.actionCoords.owner}/${it.actionCoords.name}" }
.mapValues { (_, versions) -> versions.maxByOrNull { Version(it.actionCoords.version) } }
.count { (_, wrapperRequest) -> wrapperRequest?.typingsSource == TypingsSource.ActionTypes }

writer.println(
"""
## Statistics
Number of wrappers available:
* counting by actions: ${wrappersToGenerate.groupBy { "${it.actionCoords.owner}/${it.actionCoords.name}" }.size}
* counting by actions: $uniqueActionsCount
* counting each version separately: ${wrappersToGenerate.size}
Actions [providing typings](https://github.com/krzema12/github-actions-typing/) (marked with ✅ on the above list): $uniqueActionsProvidingTypingsCount
""".trimIndent()
)
}
}

private fun ActionCoords.toMarkdownLinkToKotlinCode() =
"$version: [`${buildActionClassName()}`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/${owner.toKotlinPackageName()}/${this.buildActionClassName()}.kt)"
private fun WrapperRequest.toMarkdownLinkToKotlinCode(): String {
val typingsMarker = if (typingsSource == TypingsSource.ActionTypes) "" else ""
return "${actionCoords.version}$typingsMarker: [`${actionCoords.buildActionClassName()}`](https://github.com/krzema12/github-workflows-kt/blob/v[[ version ]]/library/src/gen/kotlin/it/krzeminski/githubactions/actions/${actionCoords.owner.toKotlinPackageName()}/${this.actionCoords.buildActionClassName()}.kt)"
}

private fun ActionCoords.toMarkdownLinkGithub() =
"[$name](https://github.com/$owner/$name)"

0 comments on commit 6e90134

Please sign in to comment.