diff --git a/build.gradle.kts b/build.gradle.kts index 5f73346022..d2013ea7f6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,6 +30,13 @@ tasks { subprojects { apply(plugin = Plugins.KTLINT_GRADLE_PLUGIN) + afterEvaluate { + if (tasks.findByName("test") != null) { + tasks.test { + systemProperty("useDefaultProperties", "") + } + } + } } repositories { diff --git a/common/.gitignore b/common/.gitignore index d5d0c34476..cab5a533b9 100644 --- a/common/.gitignore +++ b/common/.gitignore @@ -12,3 +12,4 @@ build/ out/ .gradle/ local.properties +flank-debug.properties diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 5afd106b06..d5827a2931 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -39,3 +39,21 @@ val compileTestKotlin: KotlinCompile by tasks compileTestKotlin.kotlinOptions { jvmTarget = "1.8" } + +file("flank-debug.properties").run { + if (!exists() && System.getenv("CI") == null) writeText( + """ + #zenhub.repo-id=84221974 + # + #repo.flank=Flank/flank + #repo.gcloud_cli=Flank/gcloud_cli + #repo.test-artifacts=Flank/test_artifacts + # + #integration.workflow-filename=integration_tests_pointer.yml + #integration.issue-poster=github-actions[bot] + # + #sdk-check.workflow-filename=update_dependencies_pointer.yml + #sdk-check.issue-poster=github-actions[bot] + """.trimIndent() + ) +} diff --git a/common/src/main/kotlin/flank/common/Environment.kt b/common/src/main/kotlin/flank/common/Environment.kt new file mode 100644 index 0000000000..264bf2c34b --- /dev/null +++ b/common/src/main/kotlin/flank/common/Environment.kt @@ -0,0 +1,3 @@ +package flank.common + +fun isCI() = System.getenv("CI") != null diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/utils/PathHelper.kt b/common/src/main/kotlin/flank/common/PathHelper.kt similarity index 89% rename from flank-scripts/src/main/kotlin/flank/scripts/shell/utils/PathHelper.kt rename to common/src/main/kotlin/flank/common/PathHelper.kt index 067d48796d..52d0852a69 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/utils/PathHelper.kt +++ b/common/src/main/kotlin/flank/common/PathHelper.kt @@ -1,4 +1,4 @@ -package flank.scripts.shell.utils +package flank.common import java.nio.file.Files import java.nio.file.Path @@ -20,3 +20,5 @@ val flankFixturesTmpPath = Paths.get(rootDirectoryPathString, "test_runner", "src", "test", "kotlin", "ftl", "fixtures", "tmp").toString() val flankFixturesIosTmpPath = Paths.get(flankFixturesTmpPath, "ios").toString() + +val flankCommonRootPathString = Paths.get(rootDirectoryPathString, "common").toString() diff --git a/common/src/main/kotlin/flank/common/config/FlankProperties.kt b/common/src/main/kotlin/flank/common/config/FlankProperties.kt new file mode 100644 index 0000000000..4a68568e79 --- /dev/null +++ b/common/src/main/kotlin/flank/common/config/FlankProperties.kt @@ -0,0 +1,52 @@ +package flank.common.config + +import flank.common.flankCommonRootPathString +import flank.common.isCI +import java.nio.file.Paths +import java.util.Properties + +private const val ZENHUB_REPO_ID = "zenhub.repo-id" +private const val FLANK_REPO = "repo.flank" +private const val GCLOUD_REPO = "repo.gcloud_cli" +private const val ARTIFACTS_REPO = "repo.test-artifacts" +private const val IT_WORKFLOW_FILE = "integration.workflow-filename" +private const val IT_USER = "integration.issue-poster" +private const val SDK_WORKFLOW = "sdk-check.workflow-filename" +private const val SDK_USER = "sdk-check.issue-poster" + +private val defaults = Properties().apply { + setProperty(ZENHUB_REPO_ID, "84221974") + setProperty(FLANK_REPO, "Flank/flank") + setProperty(GCLOUD_REPO, "Flank/gcloud_cli") + setProperty(ARTIFACTS_REPO, "Flank/test_artifacts") + setProperty(IT_WORKFLOW_FILE, "integration_tests_pointer.yml") + setProperty(IT_USER, "github-actions[bot]") + setProperty(SDK_WORKFLOW, "update_dependencies_pointer.yml") + setProperty(SDK_USER, "github-actions[bot]") +} + +class SafeProperties(defaults: Properties) : Properties(defaults) { + override fun get(key: Any?) = (key as String).run { + requireNotNull(if (shouldUseDefaults()) defaults.getProperty(key) else getProperty(key)) + } +} + +// default properties should be used in CI and during tests +private fun shouldUseDefaults() = isCI() || isTest() + +private fun isTest() = System.getProperty("useDefaultProperties") != null + +private val props = SafeProperties(defaults).also { prop -> + with(Paths.get("$flankCommonRootPathString/flank-debug.properties").toFile()) { + if (exists()) prop.load(inputStream()) + } +} + +val zenhubRepositoryID = Integer.parseInt(props[ZENHUB_REPO_ID]) +val flankRepository = props[FLANK_REPO] +val flankGcloudCLIRepository = props[GCLOUD_REPO] +val flankTestArtifactsRepository = props[ARTIFACTS_REPO] +val integrationOpenedIssueUser = props[IT_USER] +val updatesOpenedUser = props[SDK_USER] +val fullSuiteWorkflowFilename = props[IT_WORKFLOW_FILE] +val updateDependenciesWorkflowFilename = props[SDK_WORKFLOW] diff --git a/flank-scripts/README.md b/flank-scripts/README.md index 9d1af1766d..036f019edf 100644 --- a/flank-scripts/README.md +++ b/flank-scripts/README.md @@ -305,4 +305,20 @@ Available commands are: Applies a pre-commit hook that runs Ktlint on a commit and fails if there are lint issues. It is set to automatically fix issues if it can. ### `applyKtlintToIdea` -Applies Ktlint styling to the current idea project, so that correct code styling is upheld. \ No newline at end of file +Applies Ktlint styling to the current idea project, so that correct code styling is upheld. + +## Testing +To test your script with different settings use `flank-debug.properties` file. Uncomment and replace with desired values. +Properties are skipped by git and should not be attached to a commit. Note, `test` task ignores your own properties and will use the default. + +#### List of possible configs +| Key | Description | Default value | +|:----------------|:---------------------|:---:| +|`zenhub.repo-id`|Flank's repo ID in zenhub app. Used to create new epics.|`84221974`| +|`repo.flank`|Flank test runner repo. Essential property for github client.|`Flank/flank`| +|`repo.gcloud_cli`|Flank's fork of gcloud sdk repo.|`Flank/gcloud_cli`| +|`repo.test-artifacts`|Flank's source of artifacts (apks, binaries, etc) used for testing|`Flank/test_artifacts`| +|`integration.workflow-filename`|GH Action integration tests workflow file. Used to fetch list of commits since it's last run.|`full_suite_integration_tests.yml`| +|`integration.issue-poster`|Name of account that creates IT issue|`github-actions[bot]`| +|`sdk-check.workflow-filename`|GH Action dependencies update workflow file. Used to fetch list of commits since it's last run.|`update_dependencies_and_client.yml`| +|`sdk-check.issue-poster`|Name of account that creates dependencies issues/epics|`github-actions[bot]`| diff --git a/flank-scripts/build.gradle.kts b/flank-scripts/build.gradle.kts index 8b53535cc4..f198f3653b 100644 --- a/flank-scripts/build.gradle.kts +++ b/flank-scripts/build.gradle.kts @@ -28,7 +28,7 @@ shadowJar.apply { } } // .. -version = "1.3.4" +version = "1.4.0" group = "com.github.flank" application { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/contribution/ideaktlint/IdeaKtlintCodeStyleCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/contribution/ideaktlint/IdeaKtlintCodeStyleCommand.kt index e28c3c978c..e9b87f5cf8 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/contribution/ideaktlint/IdeaKtlintCodeStyleCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/contribution/ideaktlint/IdeaKtlintCodeStyleCommand.kt @@ -1,11 +1,11 @@ package flank.scripts.contribution.ideaktlint import com.github.ajalt.clikt.core.CliktCommand +import flank.common.currentPath import flank.common.deleteFile import flank.common.downloadFile +import flank.common.goToRoot import flank.common.logLn -import flank.scripts.shell.utils.currentPath -import flank.scripts.shell.utils.goToRoot import flank.scripts.utils.isWindows import flank.scripts.utils.runCommand import kotlinx.coroutines.runBlocking diff --git a/flank-scripts/src/main/kotlin/flank/scripts/github/GithubApi.kt b/flank-scripts/src/main/kotlin/flank/scripts/github/GithubApi.kt index 958cde340a..833e55de34 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/github/GithubApi.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/github/GithubApi.kt @@ -5,13 +5,16 @@ import com.github.kittinunf.fuel.core.Parameters import com.github.kittinunf.fuel.core.Request import com.github.kittinunf.fuel.core.extensions.authentication import com.github.kittinunf.fuel.coroutines.awaitResult +import com.github.kittinunf.fuel.coroutines.awaitStringResult import com.github.kittinunf.result.Result import com.github.kittinunf.result.onError +import com.github.kittinunf.result.success import com.jcabi.github.Coordinates import com.jcabi.github.Release import com.jcabi.github.Releases import com.jcabi.github.Repo import com.jcabi.github.RtGithub +import flank.common.config.flankRepository import flank.scripts.ci.releasenotes.GitHubRelease import flank.scripts.ci.releasenotes.GithubReleaseDeserializable import flank.scripts.exceptions.mapClientErrorToGithubException @@ -23,6 +26,9 @@ import flank.scripts.github.objects.GitHubCreateIssueCommentResponseDeserializer import flank.scripts.github.objects.GitHubCreateIssueRequest import flank.scripts.github.objects.GitHubCreateIssueResponse import flank.scripts.github.objects.GitHubCreateIssueResponseDeserializer +import flank.scripts.github.objects.GitHubLabelDeserializable +import flank.scripts.github.objects.GitHubSetAssigneesRequest +import flank.scripts.github.objects.GitHubSetLabelsRequest import flank.scripts.github.objects.GitHubUpdateIssueRequest import flank.scripts.github.objects.GitHubWorkflowRunsSummary import flank.scripts.github.objects.GithubPullRequest @@ -32,68 +38,94 @@ import flank.scripts.github.objects.GithubWorkflowRunsSummaryDeserializer import flank.scripts.utils.toJson import java.lang.Exception -private const val FLANK_REPO = "Flank/flank" private const val URL_BASE = "https://api.github.com/repos" // ============= HTTP GITHUB API ============= -suspend fun getPrDetailsByCommit(commitSha: String, githubToken: String, repo: String = FLANK_REPO): Result, Exception> = +suspend fun getPrDetailsByCommit(commitSha: String, githubToken: String, repo: String = flankRepository): Result, Exception> = Fuel.get("$URL_BASE/$repo/commits/$commitSha/pulls") .appendGitHubHeaders(githubToken, "application/vnd.github.groot-preview+json") .awaitResult(GithubPullRequestListDeserializer) .mapClientErrorToGithubException() .onError { println("Could not download info for commit $commitSha, because of ${it.message}") } -suspend fun getLatestReleaseTag(githubToken: String, repo: String = FLANK_REPO): Result = +suspend fun getLatestReleaseTag(githubToken: String, repo: String = flankRepository): Result = Fuel.get("$URL_BASE/$repo/releases/latest") .appendGitHubHeaders(githubToken) .awaitResult(GithubReleaseDeserializable) .mapClientErrorToGithubException() -suspend fun getGitHubPullRequest(githubToken: String, issueNumber: Int, repo: String = FLANK_REPO): Result = +suspend fun getGitHubPullRequest(githubToken: String, issueNumber: Int, repo: String = flankRepository): Result = Fuel.get("$URL_BASE/$repo/pulls/$issueNumber") .appendGitHubHeaders(githubToken) .awaitResult(GithubPullRequestDeserializer) .mapClientErrorToGithubException() -suspend fun getGitHubIssue(githubToken: String, issueNumber: Int, repo: String = FLANK_REPO): Result = +suspend fun getGitHubIssue(githubToken: String, issueNumber: Int, repo: String = flankRepository): Result = Fuel.get("$URL_BASE/$repo/issues/$issueNumber") .appendGitHubHeaders(githubToken) .awaitResult(GithubPullRequestDeserializer) .mapClientErrorToGithubException() -suspend fun getGitHubIssueList(githubToken: String, parameters: Parameters = emptyList(), repo: String = FLANK_REPO): Result, Exception> = +suspend fun getGitHubIssueList(githubToken: String, parameters: Parameters = emptyList(), repo: String = flankRepository): Result, Exception> = Fuel.get("$URL_BASE/$repo/issues", parameters) .appendGitHubHeaders(githubToken) .awaitResult(GithubPullRequestListDeserializer) .mapClientErrorToGithubException() -suspend fun getGitHubCommitList(githubToken: String, parameters: Parameters = emptyList(), repo: String = FLANK_REPO): Result, Exception> = +suspend fun getGitHubCommitList(githubToken: String, parameters: Parameters = emptyList(), repo: String = flankRepository): Result, Exception> = Fuel.get("$URL_BASE/$repo/commits", parameters) .appendGitHubHeaders(githubToken) .awaitResult(GitHubCommitListDeserializer) .mapClientErrorToGithubException() -suspend fun getGitHubWorkflowRunsSummary(githubToken: String, workflow: String, parameters: Parameters = emptyList(), repo: String = FLANK_REPO): Result = +suspend fun getGitHubWorkflowRunsSummary(githubToken: String, workflow: String, parameters: Parameters = emptyList(), repo: String = flankRepository): Result = Fuel.get("$URL_BASE/$repo/actions/workflows/$workflow/runs", parameters) .appendGitHubHeaders(githubToken) .awaitResult(GithubWorkflowRunsSummaryDeserializer) .mapClientErrorToGithubException() -suspend fun postNewIssueComment(githubToken: String, issueNumber: Int, payload: GitHubCreateIssueCommentRequest, repo: String = FLANK_REPO): Result = +suspend fun postNewIssueComment(githubToken: String, issueNumber: Int, payload: GitHubCreateIssueCommentRequest, repo: String = flankRepository): Result = Fuel.post("$URL_BASE/$repo/issues/$issueNumber/comments") .appendGitHubHeaders(githubToken) .body(payload.toJson()) .awaitResult(GitHubCreateIssueCommentResponseDeserializer) .mapClientErrorToGithubException() -suspend fun postNewIssue(githubToken: String, payload: GitHubCreateIssueRequest, repo: String = FLANK_REPO): Result = +suspend fun postNewIssue(githubToken: String, payload: GitHubCreateIssueRequest, repo: String = flankRepository): Result = Fuel.post("$URL_BASE/$repo/issues") .appendGitHubHeaders(githubToken) .body(payload.toJson()) .awaitResult(GitHubCreateIssueResponseDeserializer) .mapClientErrorToGithubException() -fun patchIssue(githubToken: String, issueNumber: Int, payload: GitHubUpdateIssueRequest, repo: String = FLANK_REPO): Result = +suspend fun getLabelsFromIssue(githubToken: String, issueNumber: Int, repo: String = flankRepository) = + Fuel.get("$URL_BASE/$repo/issues/$issueNumber/labels") + .appendGitHubHeaders(githubToken) + .awaitResult(GitHubLabelDeserializable) + .mapClientErrorToGithubException() + +suspend fun setLabelsToPullRequest(githubToken: String, pullRequestNumber: Int, labels: List, repo: String = flankRepository) { + Fuel.post("$URL_BASE/$repo/issues/$pullRequestNumber/labels") + .appendGitHubHeaders(githubToken) + .body(GitHubSetLabelsRequest(labels).toJson()) + .awaitStringResult() + .onError { println("Could not set assignees because of ${it.message}") } + .success { println("$labels set to pull request #$pullRequestNumber") } +} + +suspend fun setAssigneesToPullRequest(githubToken: String, pullRequestNumber: Int, assignees: List, repo: String = flankRepository) { + Fuel.post("$URL_BASE/$repo/issues/$pullRequestNumber/assignees") + .appendGitHubHeaders(githubToken) + .body(GitHubSetAssigneesRequest(assignees).toJson()) + .awaitStringResult() + .onError { + println("Could not set assignees because of ${it.message}") + it.printStackTrace() + } + .success { println("$assignees set to pull request #$pullRequestNumber") } +} + +fun patchIssue(githubToken: String, issueNumber: Int, payload: GitHubUpdateIssueRequest, repo: String = flankRepository): Result = Fuel.patch("$URL_BASE/$repo/issues/$issueNumber") .appendGitHubHeaders(githubToken) .body(payload.toJson()) @@ -101,7 +133,7 @@ fun patchIssue(githubToken: String, issueNumber: Int, payload: GitHubUpdateIssue .third .mapClientErrorToGithubException() -fun deleteOldTag(tag: String, username: String, password: String, repo: String = FLANK_REPO): Result = +fun deleteOldTag(tag: String, username: String, password: String, repo: String = flankRepository): Result = Fuel.delete("$URL_BASE/$repo/git/refs/tags/$tag") .authentication() .basic(username, password) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/github/objects/GitHubSetAssigneesRequest.kt b/flank-scripts/src/main/kotlin/flank/scripts/github/objects/GitHubSetAssigneesRequest.kt new file mode 100644 index 0000000000..56da1afdf9 --- /dev/null +++ b/flank-scripts/src/main/kotlin/flank/scripts/github/objects/GitHubSetAssigneesRequest.kt @@ -0,0 +1,8 @@ +package flank.scripts.github.objects + +import kotlinx.serialization.Serializable + +@Serializable +data class GitHubSetAssigneesRequest( + val assignees: List +) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/github/objects/GitHubSetLabelsRequest.kt b/flank-scripts/src/main/kotlin/flank/scripts/github/objects/GitHubSetLabelsRequest.kt new file mode 100644 index 0000000000..bb5300149a --- /dev/null +++ b/flank-scripts/src/main/kotlin/flank/scripts/github/objects/GitHubSetLabelsRequest.kt @@ -0,0 +1,8 @@ +package flank.scripts.github.objects + +import kotlinx.serialization.Serializable + +@Serializable +data class GitHubSetLabelsRequest( + val labels: List +) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/integration/IssueList.kt b/flank-scripts/src/main/kotlin/flank/scripts/integration/IssueList.kt index c3e29a123f..be5f1b8003 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/integration/IssueList.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/integration/IssueList.kt @@ -2,12 +2,13 @@ package flank.scripts.integration import com.github.kittinunf.result.getOrElse import com.github.kittinunf.result.onError +import flank.common.config.integrationOpenedIssueUser import flank.scripts.github.getGitHubIssueList suspend fun checkForOpenedITIssues(token: String): Int? = getGitHubIssueList( githubToken = token, parameters = listOf( - "creator" to "github-actions[bot]", + "creator" to integrationOpenedIssueUser, "state" to "open", "labels" to "IT_Failed" ) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/integration/PrepareMessage.kt b/flank-scripts/src/main/kotlin/flank/scripts/integration/PrepareMessage.kt index 1dc412c26d..d76f0aefc1 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/integration/PrepareMessage.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/integration/PrepareMessage.kt @@ -1,5 +1,6 @@ package flank.scripts.integration +import flank.common.config.flankRepository import flank.scripts.github.objects.GithubPullRequest import java.time.Instant import java.time.LocalDateTime @@ -33,7 +34,7 @@ private val successTemplate = { lastRun: String, runId: String, url: String -> """ |### Full suite IT run :white_check_mark: SUCCEEDED :white_check_mark: |**Timestamp:** ${makeHumanFriendly(lastRun)} - |**Job run:** [$runId](https://github.com/Flank/flank/actions/runs/$runId) + |**Job run:** [$runId](https://github.com/$flankRepository/actions/runs/$runId) |**Build scan URL:** $url |**Closing issue** """.trimMargin() @@ -43,7 +44,7 @@ private val failureTemplate = { lastRun: String, runId: String, url: String -> """ |### Full suite IT run :x: FAILED :x: |**Timestamp:** ${makeHumanFriendly(lastRun)} - |**Job run:** [$runId](https://github.com/Flank/flank/actions/runs/$runId) + |**Job run:** [$runId](https://github.com/$flankRepository/actions/runs/$runId) |**Build scan URL:** $url """.trimMargin() } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/integration/WorkflowSummary.kt b/flank-scripts/src/main/kotlin/flank/scripts/integration/WorkflowSummary.kt index 7b8457366d..7350ea4be0 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/integration/WorkflowSummary.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/integration/WorkflowSummary.kt @@ -1,8 +1,9 @@ package flank.scripts.integration +import flank.common.config.fullSuiteWorkflowFilename import flank.scripts.github.commons.getLastWorkflowRunDate suspend fun getLastITWorkflowRunDate(token: String) = getLastWorkflowRunDate( token = token, - workflowFileName = "integration_tests_pointer.yml" + workflowFileName = fullSuiteWorkflowFilename ) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetAssignees.kt b/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetAssignees.kt index 2d82a6937d..e33531d75d 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetAssignees.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetAssignees.kt @@ -1,15 +1,10 @@ package flank.scripts.pullrequest -import com.github.kittinunf.fuel.Fuel -import com.github.kittinunf.fuel.coroutines.awaitStringResult import com.github.kittinunf.result.getOrNull import com.github.kittinunf.result.map import com.github.kittinunf.result.onError -import com.github.kittinunf.result.success -import flank.scripts.github.appendGitHubHeaders import flank.scripts.github.getGitHubIssue -import flank.scripts.utils.toJson -import kotlinx.serialization.Serializable +import flank.scripts.github.setAssigneesToPullRequest suspend fun copyAssignees(githubToken: String, baseIssueNumber: Int, pullRequestNumber: Int) { getGitHubIssue(githubToken, baseIssueNumber) @@ -18,20 +13,3 @@ suspend fun copyAssignees(githubToken: String, baseIssueNumber: Int, pullRequest .getOrNull() ?.let { setAssigneesToPullRequest(githubToken, pullRequestNumber, it) } } - -private suspend fun setAssigneesToPullRequest(githubToken: String, pullRequestNumber: Int, assignees: List) { - Fuel.post("https://api.github.com/repos/Flank/flank/issues/$pullRequestNumber/assignees") - .appendGitHubHeaders(githubToken) - .body(SetAssigneesRequest(assignees).toJson()) - .awaitStringResult() - .onError { - println("Could not set assignees because of ${it.message}") - it.printStackTrace() - } - .success { println("$assignees set to pull request #$pullRequestNumber") } -} - -@Serializable -private data class SetAssigneesRequest( - val assignees: List -) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetLabels.kt b/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetLabels.kt index f1c726548a..8d1f6a301c 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetLabels.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/pullrequest/SetLabels.kt @@ -1,17 +1,10 @@ package flank.scripts.pullrequest -import com.github.kittinunf.fuel.Fuel -import com.github.kittinunf.fuel.coroutines.awaitResult -import com.github.kittinunf.fuel.coroutines.awaitStringResult import com.github.kittinunf.result.getOrNull import com.github.kittinunf.result.map import com.github.kittinunf.result.onError -import com.github.kittinunf.result.success -import flank.scripts.exceptions.mapClientErrorToGithubException -import flank.scripts.github.appendGitHubHeaders -import flank.scripts.github.objects.GitHubLabelDeserializable -import flank.scripts.utils.toJson -import kotlinx.serialization.Serializable +import flank.scripts.github.getLabelsFromIssue +import flank.scripts.github.setLabelsToPullRequest suspend fun copyLabels(githubToken: String, issueNumber: Int, pullRequestNumber: Int) { getLabelsFromIssue(githubToken, issueNumber) @@ -20,23 +13,3 @@ suspend fun copyLabels(githubToken: String, issueNumber: Int, pullRequestNumber: .getOrNull() ?.run { setLabelsToPullRequest(githubToken, pullRequestNumber, this) } } - -private suspend fun getLabelsFromIssue(githubToken: String, issueNumber: Int) = - Fuel.get("https://api.github.com/repos/Flank/flank/issues/$issueNumber/labels") - .appendGitHubHeaders(githubToken) - .awaitResult(GitHubLabelDeserializable) - .mapClientErrorToGithubException() - -private suspend fun setLabelsToPullRequest(githubToken: String, pullRequestNumber: Int, labels: List) { - Fuel.post("https://api.github.com/repos/Flank/flank/issues/$pullRequestNumber/labels") - .appendGitHubHeaders(githubToken) - .body(SetLabelsRequest(labels).toJson()) - .awaitStringResult() - .onError { println("Could not set assignees because of ${it.message}") } - .success { println("$labels set to pull request #$pullRequestNumber") } -} - -@Serializable -private data class SetLabelsRequest( - val labels: List -) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/release/updatebugsnag/UpdateBugSnag.kt b/flank-scripts/src/main/kotlin/flank/scripts/release/updatebugsnag/UpdateBugSnag.kt index e3055041d3..49ebbab51d 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/release/updatebugsnag/UpdateBugSnag.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/release/updatebugsnag/UpdateBugSnag.kt @@ -3,6 +3,7 @@ package flank.scripts.release.updatebugsnag import com.github.kittinunf.fuel.Fuel import com.github.kittinunf.fuel.core.extensions.jsonBody import com.github.kittinunf.fuel.coroutines.awaitResult +import flank.common.config.flankRepository import flank.scripts.exceptions.mapClientError import flank.scripts.exceptions.toBugsnagException import flank.scripts.utils.toJson @@ -33,4 +34,4 @@ private fun githubActionsSourceControl(appVersion: String) = SourceControl( ) private const val BUGNSAG_URL = "https://build.bugsnag.com/" -private const val REPOSITORY = "https://github.com/Flank/flank" +private val REPOSITORY = "https://github.com/$flankRepository" diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/BuildFlank.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/BuildFlank.kt index c8fe356b00..92fa0c5166 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/BuildFlank.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/BuildFlank.kt @@ -1,8 +1,8 @@ package flank.scripts.shell import com.github.ajalt.clikt.core.CliktCommand +import flank.common.rootDirectoryPathString import flank.scripts.shell.utils.createGradleCommand -import flank.scripts.shell.utils.rootDirectoryPathString import flank.scripts.utils.runCommand import java.nio.file.Files import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/apiclient/UpdateApiJsonCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/apiclient/UpdateApiJsonCommand.kt index 138fa85004..bce2aff3c9 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/apiclient/UpdateApiJsonCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/apiclient/UpdateApiJsonCommand.kt @@ -1,8 +1,9 @@ package flank.scripts.shell.firebase.apiclient import com.github.ajalt.clikt.core.CliktCommand +import flank.common.config.flankGcloudCLIRepository +import flank.common.currentPath import flank.common.downloadFile -import flank.scripts.shell.utils.currentPath import flank.scripts.utils.downloadSortJsonIfNeeded import flank.scripts.utils.runCommand import java.nio.file.Paths @@ -14,12 +15,12 @@ object UpdateApiJsonCommand : CliktCommand(name = "updateApiJson", help = "Downl val testingV1Beta3Path = Paths.get(jsonDirectoryPath.toString(), "toolresults_v1beta3.json").toString() downloadFile( - "https://raw.githubusercontent.com/Flank/gcloud_cli/master/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/testing_v1.json", + "https://raw.githubusercontent.com/$flankGcloudCLIRepository/master/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/testing_v1.json", testingV1Path ) downloadFile( - "https://raw.githubusercontent.com/Flank/gcloud_cli/master/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/toolresults_v1beta3.json", + "https://raw.githubusercontent.com/$flankGcloudCLIRepository/master/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/toolresults_v1beta3.json", testingV1Beta3Path ) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CheckForSDKUpdateCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CheckForSDKUpdateCommand.kt index 0983fed7c5..2c81f4bf84 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CheckForSDKUpdateCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CheckForSDKUpdateCommand.kt @@ -4,14 +4,15 @@ import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.required import com.github.kittinunf.fuel.Fuel +import flank.common.config.flankGcloudCLIRepository +import flank.common.currentPath import flank.common.downloadFile -import flank.scripts.shell.utils.currentPath import flank.scripts.utils.parseToVersion import kotlinx.coroutines.runBlocking import java.nio.file.Paths import java.time.Instant -private const val RAW_GITHUB = "https://raw.githubusercontent.com/Flank/gcloud_cli" +private val RAW_GITHUB = "https://raw.githubusercontent.com/$flankGcloudCLIRepository" object CheckForSDKUpdateCommand : CliktCommand( name = "checkForSdkUpdate", diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CommitList.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CommitList.kt index bf003e0445..cf3b666a06 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CommitList.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/CommitList.kt @@ -1,5 +1,6 @@ package flank.scripts.shell.firebase.sdk +import flank.common.config.flankGcloudCLIRepository import flank.scripts.github.getGitHubCommitList import flank.scripts.github.objects.GitHubCommit import java.time.Instant @@ -12,7 +13,7 @@ suspend fun getCommitsUntilLastCheck(token: String, until: String): String? = ge "per_page" to 10, "until" to until ), - repo = "Flank/gcloud_cli" + repo = flankGcloudCLIRepository ) .get() .maxByOrNull { Instant.from(DateTimeFormatter.ISO_INSTANT.parse(it.commit.author.date)) } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/Extensions.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/Extensions.kt index d007781c92..70ad8115b7 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/Extensions.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/Extensions.kt @@ -2,13 +2,13 @@ package flank.scripts.shell.firebase.sdk import com.github.kittinunf.result.Result import com.github.kittinunf.result.onError +import flank.common.config.zenhubRepositoryID import flank.common.newLine import flank.scripts.github.objects.GitHubCreateIssueRequest import flank.scripts.github.objects.GitHubCreateIssueResponse import flank.scripts.github.objects.GitHubUpdateIssueRequest import flank.scripts.github.patchIssue import flank.scripts.github.postNewIssue -import flank.scripts.zenhub.FLANK_REPO_ID import flank.scripts.zenhub.convertIssueToEpic import flank.scripts.zenhub.objects.ConvertToEpicRequest import flank.scripts.zenhub.objects.Issue @@ -74,7 +74,7 @@ private suspend fun SDKUpdateContext.createSubIssues() = coroutineScope { } } .awaitAll() - .map { Issue(FLANK_REPO_ID, it.number) } + .map { Issue(zenhubRepositoryID, it.number) } } } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/LastSDKUpdateRun.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/LastSDKUpdateRun.kt index c7ae5b9653..ad5f5b31fc 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/LastSDKUpdateRun.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/LastSDKUpdateRun.kt @@ -1,8 +1,9 @@ package flank.scripts.shell.firebase.sdk +import flank.common.config.updateDependenciesWorkflowFilename import flank.scripts.github.commons.getLastWorkflowRunDate suspend fun getLastSDKUpdateRunDate(token: String) = getLastWorkflowRunDate( token = token, - workflowFileName = "update_dependencies_pointer.yml" + workflowFileName = updateDependenciesWorkflowFilename ) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/OpenedUpdates.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/OpenedUpdates.kt index 72ef8f60ec..290bc21574 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/OpenedUpdates.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/firebase/sdk/OpenedUpdates.kt @@ -2,12 +2,13 @@ package flank.scripts.shell.firebase.sdk import com.github.kittinunf.result.getOrElse import com.github.kittinunf.result.onError +import flank.common.config.updatesOpenedUser import flank.scripts.github.getGitHubIssueList suspend fun checkForOpenedUpdates(token: String) = getGitHubIssueList( githubToken = token, parameters = listOf( - "creator" to "github-actions[bot]", + "creator" to updatesOpenedUser, "state" to "open", "labels" to "gcloud SDK" ) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/BuildExample.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/BuildExample.kt index 090b670c68..43838aadca 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/BuildExample.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/BuildExample.kt @@ -3,9 +3,9 @@ package flank.scripts.shell.ios import com.github.ajalt.clikt.core.CliktCommand import flank.common.archive -import flank.scripts.shell.utils.currentPath +import flank.common.currentPath +import flank.common.iOSTestProjectsPath import flank.scripts.shell.utils.failIfWindows -import flank.scripts.shell.utils.iOSTestProjectsPath import flank.scripts.shell.utils.pipe import flank.scripts.utils.downloadXcPrettyIfNeeded import flank.scripts.utils.installPodsIfNeeded diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/RunFtlLocal.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/RunFtlLocal.kt index ff20f624ab..c71c18f33f 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/RunFtlLocal.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/RunFtlLocal.kt @@ -3,7 +3,7 @@ package flank.scripts.shell.ios import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.required -import flank.scripts.shell.utils.currentPath +import flank.common.currentPath import flank.scripts.shell.utils.failIfWindows import flank.scripts.utils.runCommand import java.nio.file.Path diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/SetupIosEnvCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/SetupIosEnvCommand.kt index b7d2f160a6..40424ce04c 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/SetupIosEnvCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/SetupIosEnvCommand.kt @@ -1,9 +1,9 @@ package flank.scripts.shell.ios import com.github.ajalt.clikt.core.CliktCommand +import flank.common.iOSTestProjectsPath import flank.scripts.shell.ops.EARL_GREY_EXAMPLE import flank.scripts.shell.utils.failIfWindows -import flank.scripts.shell.utils.iOSTestProjectsPath import flank.scripts.utils.downloadCocoaPodsIfNeeded import flank.scripts.utils.installPodsIfNeeded import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/UniversalFramework.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/UniversalFramework.kt index d96be8649e..3b4f309acc 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/UniversalFramework.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ios/UniversalFramework.kt @@ -1,7 +1,7 @@ package flank.scripts.shell.ios import com.github.ajalt.clikt.core.CliktCommand -import flank.scripts.shell.utils.currentPath +import flank.common.currentPath import flank.scripts.shell.utils.failIfWindows import flank.scripts.utils.runCommand import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildAndroid.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildAndroid.kt index 4d3cea1131..8bec169095 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildAndroid.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildAndroid.kt @@ -1,8 +1,8 @@ package flank.scripts.shell.ops -import flank.scripts.shell.utils.androidTestProjectsPath +import flank.common.androidTestProjectsPath +import flank.common.flankFixturesTmpPath import flank.scripts.shell.utils.createGradleCommand -import flank.scripts.shell.utils.flankFixturesTmpPath import flank.scripts.utils.runCommand import java.io.File import java.nio.file.Files diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildEarlGreyExampleCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildEarlGreyExampleCommand.kt index 8da01cfa1d..1abb73680a 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildEarlGreyExampleCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildEarlGreyExampleCommand.kt @@ -3,8 +3,8 @@ package flank.scripts.shell.ops import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option +import flank.common.iOSTestProjectsPath import flank.scripts.shell.utils.failIfWindows -import flank.scripts.shell.utils.iOSTestProjectsPath import java.nio.file.Paths object BuildEarlGreyExampleCommand : CliktCommand(name = "build_earl_grey_example", help = "Build ios earl grey example app with tests") { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildFlankExampleCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildFlankExampleCommand.kt index 873339867e..a4e0959999 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildFlankExampleCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildFlankExampleCommand.kt @@ -3,8 +3,8 @@ package flank.scripts.shell.ops import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option +import flank.common.iOSTestProjectsPath import flank.scripts.shell.utils.failIfWindows -import flank.scripts.shell.utils.iOSTestProjectsPath import java.nio.file.Paths object BuildFlankExampleCommand : CliktCommand(name = "build_flank_example", help = "Build ios flank example app with tests") { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildGameLoopExampleCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildGameLoopExampleCommand.kt index d77902d2f5..3dce78b843 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildGameLoopExampleCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildGameLoopExampleCommand.kt @@ -3,8 +3,8 @@ package flank.scripts.shell.ops import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option +import flank.common.iOSTestProjectsPath import flank.scripts.shell.utils.failIfWindows -import flank.scripts.shell.utils.iOSTestProjectsPath import java.nio.file.Paths object BuildGameLoopExampleCommand : CliktCommand( diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosIPA.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosIPA.kt index 71055673f2..745b00123e 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosIPA.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosIPA.kt @@ -1,8 +1,8 @@ package flank.scripts.shell.ops +import flank.common.flankFixturesIosTmpPath import flank.scripts.shell.ios.createXcodeArchiveCommand import flank.scripts.shell.ios.createXcodeExportArchiveCommand -import flank.scripts.shell.utils.flankFixturesIosTmpPath import flank.scripts.shell.utils.pipe import flank.scripts.utils.downloadCocoaPodsIfNeeded import flank.scripts.utils.downloadXcPrettyIfNeeded diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosTestArtifacts.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosTestArtifacts.kt index 42fe48f0e3..4668ad181d 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosTestArtifacts.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildIosTestArtifacts.kt @@ -1,8 +1,8 @@ package flank.scripts.shell.ops import flank.common.archive +import flank.common.flankFixturesIosTmpPath import flank.scripts.shell.ios.createXcodeBuildForTestingCommand -import flank.scripts.shell.utils.flankFixturesIosTmpPath import flank.scripts.shell.utils.pipe import flank.scripts.utils.downloadCocoaPodsIfNeeded import flank.scripts.utils.downloadXcPrettyIfNeeded diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildTestPlansExample.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildTestPlansExample.kt index 916bb5f4ac..b7ddbc1749 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildTestPlansExample.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/BuildTestPlansExample.kt @@ -3,8 +3,8 @@ package flank.scripts.shell.ops import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option +import flank.common.iOSTestProjectsPath import flank.scripts.shell.utils.failIfWindows -import flank.scripts.shell.utils.iOSTestProjectsPath import java.nio.file.Paths object BuildTestPlansExample : CliktCommand(name = "build_ios_testplans_example", help = "Build ios test plans example app") { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/GoOpsCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/GoOpsCommand.kt index 761ca0703e..e03f0c0f07 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/GoOpsCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/shell/ops/GoOpsCommand.kt @@ -1,8 +1,8 @@ package flank.scripts.shell.ops import com.github.ajalt.clikt.core.CliktCommand -import flank.scripts.shell.utils.flankFixturesTmpPath -import flank.scripts.shell.utils.testProjectsPath +import flank.common.flankFixturesTmpPath +import flank.common.testProjectsPath import flank.scripts.utils.runCommand import java.nio.file.Path import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/Constants.kt b/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/Constants.kt index ca05fb88e5..53d1541c2b 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/Constants.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/Constants.kt @@ -4,8 +4,6 @@ import flank.scripts.utils.currentGitBranch import java.io.File const val GITHUB_TOKEN_ENV_KEY = "GITHUB_TOKEN" -const val TEST_ARTIFACTS_REPO = "Flank/test_artifacts" - const val FIXTURES_PATH = "test_runner/src/test/kotlin/ftl/fixtures/tmp" const val TEST_ARTIFACTS_PATH = "test_artifacts" diff --git a/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/TestArtifactsRepo.kt b/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/TestArtifactsRepo.kt index 5cbe0d79c4..f9c2da896c 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/TestArtifactsRepo.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/testartifacts/core/TestArtifactsRepo.kt @@ -1,7 +1,8 @@ package flank.scripts.testartifacts.core import com.jcabi.github.Repo +import flank.common.config.flankTestArtifactsRepository import flank.scripts.github.githubRepo import flank.scripts.utils.getEnv -internal fun testArtifactsRepo(): Repo = githubRepo(getEnv(GITHUB_TOKEN_ENV_KEY), TEST_ARTIFACTS_REPO) +internal fun testArtifactsRepo(): Repo = githubRepo(getEnv(GITHUB_TOKEN_ENV_KEY), flankTestArtifactsRepository) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/zenhub/ZenHubAPI.kt b/flank-scripts/src/main/kotlin/flank/scripts/zenhub/ZenHubAPI.kt index ce84aa7088..2e5a4faff6 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/zenhub/ZenHubAPI.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/zenhub/ZenHubAPI.kt @@ -7,13 +7,13 @@ import com.github.kittinunf.fuel.coroutines.awaitStringResult import com.github.kittinunf.result.getOrNull import com.github.kittinunf.result.onError import com.github.kittinunf.result.success +import flank.common.config.zenhubRepositoryID import flank.scripts.utils.toJson import flank.scripts.zenhub.objects.ConvertToEpicRequest import flank.scripts.zenhub.objects.UpdateEpicRequest import kotlinx.serialization.Serializable -const val FLANK_REPO_ID = 84221974 -internal const val ZENHUB_BASE_URL = "https://api.zenhub.com/p1/repositories/$FLANK_REPO_ID" +internal val ZENHUB_BASE_URL = "https://api.zenhub.com/p1/repositories/$zenhubRepositoryID" suspend fun copyEstimation(zenhubToken: String, issueNumber: Int, pullRequestNumber: Int) { getEstimation(zenhubToken, issueNumber)