File tree Expand file tree Collapse file tree 6 files changed +16
-12
lines changed
automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/codegenerator
src/main/kotlin/io/github/typesafegithub/workflows/jitbindingserver
shared-internal/src/main/kotlin/io/github/typesafegithub/workflows/shared/internal Expand file tree Collapse file tree 6 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ import io.github.typesafegithub.workflows.codegenerator.bindingsToGenerate
1010import io.github.typesafegithub.workflows.codegenerator.model.ActionBindingRequest
1111import io.github.typesafegithub.workflows.codegenerator.versions.GithubRef
1212import io.github.typesafegithub.workflows.codegenerator.versions.GithubTag
13- import io.github.typesafegithub.workflows.codegenerator.versions.getGithubToken
1413import io.github.typesafegithub.workflows.codegenerator.versions.httpClient
1514import io.github.typesafegithub.workflows.codegenerator.versions.json
15+ import io.github.typesafegithub.workflows.shared.internal.getGithubToken
1616import io.ktor.client.request.bearerAuth
1717import io.ktor.client.request.get
1818import io.ktor.client.statement.bodyAsText
Original file line number Diff line number Diff line change @@ -18,16 +18,6 @@ val ActionCoords.apiTagsUrl: String
1818val ActionCoords .apiBranchesUrl: String
1919 get() = " https://api.github.com/repos/$owner /$name /git/matching-refs/heads/v"
2020
21- fun getGithubToken (): String =
22- System .getenv(" GITHUB_TOKEN" )
23- ? : error(
24- """
25- Missing environment variable export GITHUB_TOKEN=token
26- Create a personal token at https://github.com/settings/tokens
27- The token needs to have public_repo scope.
28- """ .trimIndent(),
29- )
30-
3121@Serializable
3222data class GithubRef (
3323 val ref : String ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import io.github.typesafegithub.workflows.actionbindinggenerator.domain.prettyPr
99import io.github.typesafegithub.workflows.actionbindinggenerator.metadata.Metadata
1010import io.github.typesafegithub.workflows.actionbindinggenerator.metadata.fetchMetadata
1111import io.github.typesafegithub.workflows.codegenerator.bindingsToGenerate
12+ import io.github.typesafegithub.workflows.shared.internal.getGithubToken
1213import io.github.typesafegithub.workflows.shared.internal.model.Version
1314import java.io.File
1415
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ dependencies {
1414 implementation(" ch.qos.logback:logback-classic:1.5.6" )
1515
1616 implementation(projects.mavenBindingBuilder)
17+ implementation(projects.sharedInternal)
1718}
1819
1920application {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import io.github.typesafegithub.workflows.mavenbinding.JarArtifact
88import io.github.typesafegithub.workflows.mavenbinding.TextArtifact
99import io.github.typesafegithub.workflows.mavenbinding.buildPackageArtifacts
1010import io.github.typesafegithub.workflows.mavenbinding.buildVersionArtifacts
11+ import io.github.typesafegithub.workflows.shared.internal.getGithubToken
1112import io.ktor.http.ContentType
1213import io.ktor.http.HttpStatusCode
1314import io.ktor.server.application.call
@@ -110,7 +111,7 @@ fun main() {
110111 name = name,
111112 version = " irrelevant" ,
112113 )
113- val bindingArtifacts = actionCoords.buildPackageArtifacts(githubToken = System .getenv( " GITHUB_TOKEN " ))
114+ val bindingArtifacts = actionCoords.buildPackageArtifacts(githubToken = getGithubToken( ))
114115 if (file in bindingArtifacts) {
115116 when (val artifact = bindingArtifacts[file]) {
116117 is String -> call.respondText(artifact)
Original file line number Diff line number Diff line change 1+ package io.github.typesafegithub.workflows.shared.internal
2+
3+ fun getGithubToken (): String =
4+ System .getenv(" GITHUB_TOKEN" )
5+ ? : error(
6+ """
7+ Missing environment variable export GITHUB_TOKEN=token
8+ Create a personal token at https://github.com/settings/tokens
9+ The token needs to have public_repo scope.
10+ """ .trimIndent(),
11+ )
You can’t perform that action at this time.
0 commit comments