@@ -31,9 +31,6 @@ private val Project.libParamValue get() = prop<String>("jupyter.lib.param.value"
31
31
private val Project .prGithubUser get() = prop<String >(" jupyter.github.user" )
32
32
private val Project .prGithubToken get() = prop<String >(" jupyter.github.token" )
33
33
34
- private val Project .githubRepoOwner get() = prop<String >(" githubRepoUser" )
35
- private val Project .githubRepoName get() = prop<String >(" githubRepoName" )
36
-
37
34
@Serializable
38
35
class NewPrData (
39
36
val title : String ,
@@ -89,11 +86,12 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
89
86
val pushChangesTask = tasks.register(" pushChanges" ) {
90
87
dependsOn(updateLibraryParamTask)
91
88
89
+ val librariesDir = projectDir.resolve(librariesPath)
92
90
fun execGit (vararg args : String , configure : ExecSpec .() -> Unit = {}): ExecResult {
93
91
return exec {
94
92
this .executable = " git"
95
93
this .args = args.asList()
96
- this .workingDir = projectDir
94
+ this .workingDir = librariesDir
97
95
98
96
configure()
99
97
}
@@ -106,8 +104,13 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
106
104
execGit(" add" , " ." )
107
105
execGit(" commit" , " -m" , " [AUTO] Update library version" )
108
106
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!! ) {
111
114
this .standardOutput = object : OutputStream () {
112
115
override fun write (b : Int ) { }
113
116
}
@@ -123,6 +126,7 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
123
126
doLast {
124
127
val user = rootProject.prGithubUser
125
128
val password = rootProject.prGithubToken
129
+ val repoUserAndName = rootProject.property(" librariesRepoUserAndName" ) as String
126
130
fun githubRequest (
127
131
method : Method ,
128
132
request : String ,
@@ -141,9 +145,8 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
141
145
return response
142
146
}
143
147
144
- val fullRepo = " ${rootProject.githubRepoOwner} /${rootProject.githubRepoName} "
145
148
val prResponse = githubRequest(
146
- Method .POST , " repos/$fullRepo /pulls" ,
149
+ Method .POST , " repos/$repoUserAndName /pulls" ,
147
150
Json .encodeToJsonElement(
148
151
NewPrData (
149
152
title = " Update `${rootProject.libName} ` library to `${rootProject.libParamValue} `" ,
@@ -157,7 +160,7 @@ fun ProjectWithInstallOptions.prepareKotlinVersionUpdateTasks() {
157
160
158
161
val prNumber = (prResponse.jsonObject[" number" ] as JsonPrimitive ).int
159
162
githubRequest(
160
- Method .POST , " repos/$fullRepo /issues/$prNumber /labels" ,
163
+ Method .POST , " repos/$repoUserAndName /issues/$prNumber /labels" ,
161
164
Json .encodeToJsonElement(
162
165
SetLabelsData (listOf (" no-changelog" , " library-descriptors" ))
163
166
)
0 commit comments