@@ -31,9 +31,6 @@ private val Project.libParamValue get() = prop<String>("jupyter.lib.param.value"
3131private val Project .prGithubUser get() = prop<String >(" jupyter.github.user" )
3232private val Project .prGithubToken get() = prop<String >(" jupyter.github.token" )
3333
34- private val Project .githubRepoOwner get() = prop<String >(" githubRepoUser" )
35- private val Project .githubRepoName get() = prop<String >(" githubRepoName" )
36-
3734@Serializable
3835class NewPrData (
3936 val title : String ,
@@ -89,11 +86,12 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
8986 val pushChangesTask = tasks.register(" pushChanges" ) {
9087 dependsOn(updateLibraryParamTask)
9188
89+ val librariesDir = projectDir.resolve(librariesPath)
9290 fun execGit (vararg args : String , configure : ExecSpec .() -> Unit = {}): ExecResult {
9391 return exec {
9492 this .executable = " git"
9593 this .args = args.asList()
96- this .workingDir = projectDir
94+ this .workingDir = librariesDir
9795
9896 configure()
9997 }
@@ -106,8 +104,13 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
106104 execGit(" add" , " ." )
107105 execGit(" commit" , " -m" , " [AUTO] Update library version" )
108106
109- val repoUrl = rootProject.property(" pushRepoUrl" ) as String
110- execGit(" push" , " --force" , " -u" , repoUrl, getCurrentBranch() + " :refs/heads/" + updateLibBranchName!! ) {
107+ val repoUrl = rootProject.property(" librariesRepoUrl" ) as String
108+ val currentBranch = getPropertyByCommand(
109+ " build.libraries.branch" ,
110+ arrayOf(" git" , " rev-parse" , " --abbrev-ref" , " HEAD" ),
111+ librariesDir,
112+ )
113+ execGit(" push" , " --force" , " -u" , repoUrl, " $currentBranch :refs/heads/" + updateLibBranchName!! ) {
111114 this .standardOutput = object : OutputStream () {
112115 override fun write (b : Int ) { }
113116 }
@@ -123,6 +126,7 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
123126 doLast {
124127 val user = rootProject.prGithubUser
125128 val password = rootProject.prGithubToken
129+ val repoUserAndName = rootProject.property(" librariesRepoUserAndName" ) as String
126130 fun githubRequest (
127131 method : Method ,
128132 request : String ,
@@ -141,9 +145,8 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
141145 return response
142146 }
143147
144- val fullRepo = " ${rootProject.githubRepoOwner} /${rootProject.githubRepoName} "
145148 val prResponse = githubRequest(
146- Method .POST , " repos/$fullRepo /pulls" ,
149+ Method .POST , " repos/$repoUserAndName /pulls" ,
147150 Json .encodeToJsonElement(
148151 NewPrData (
149152 title = " Update `${rootProject.libName} ` library to `${rootProject.libParamValue} `" ,
@@ -157,7 +160,7 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
157160
158161 val prNumber = (prResponse.jsonObject[" number" ] as JsonPrimitive ).int
159162 githubRequest(
160- Method .POST , " repos/$fullRepo /issues/$prNumber /labels" ,
163+ Method .POST , " repos/$repoUserAndName /issues/$prNumber /labels" ,
161164 Json .encodeToJsonElement(
162165 SetLabelsData (listOf (" no-changelog" , " library-descriptors" ))
163166 )
0 commit comments