File tree Expand file tree Collapse file tree 4 files changed +27
-10
lines changed
plugins/src/main/java/com/jraska/github/client/release Expand file tree Collapse file tree 4 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ android {
2424 applicationId " com.jraska.github.client"
2525 minSdkVersion 24
2626 targetSdkVersion 30
27- versionName ' 0.23.0 '
28- versionCode 87
27+ versionName ' 0.23.1 '
28+ versionCode 88
2929 multiDexEnabled true
3030
3131 testInstrumentationRunner " com.jraska.github.client.TestRunner"
Original file line number Diff line number Diff line change 1+ package com.jraska.github.client.release
2+
3+ import okhttp3.HttpUrl
4+ import okhttp3.HttpUrl.Companion.toHttpUrl
5+ import java.lang.IllegalStateException
6+
7+ class Environment (
8+ val apiToken : String ,
9+ val baseUrl : HttpUrl = " https://api.github.com/repos/jraska/github-client/" .toHttpUrl()
10+ ) {
11+ companion object {
12+ fun create (): Environment {
13+ val apiToken = System .getenv(" TOKEN_GITHUB_API" ) ? : throw IllegalStateException (" GitHub API token missing" )
14+ return Environment (apiToken)
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
55
66object ReleaseMarksPRs {
77 fun execute (tag : String ) {
8- val release = Release (tag, " https://github.com/jraska/github-client/releases/tag/$tag " .toHttpUrl())
8+ val environment = Environment .create()
9+ val release = Release (tag, " ${environment.baseUrl} releases/tag/$tag " .toHttpUrl())
910
10- val api = GitHubApiFactory .create()
11+ val api = GitHubApiFactory .create(environment )
1112 val releaseMarker = ReleaseMarker (api, NotesComposer ())
1213
1314 releaseMarker.markPrsWithMilestone(release)
Original file line number Diff line number Diff line change 11package com.jraska.github.client.release.data
22
3+ import com.jraska.github.client.release.Environment
34import com.jraska.github.client.release.GitHubApi
45import okhttp3.OkHttpClient
56import okhttp3.logging.HttpLoggingInterceptor
@@ -8,16 +9,14 @@ import retrofit2.converter.gson.GsonConverterFactory
89import java.lang.IllegalStateException
910
1011object GitHubApiFactory {
11- fun create (): GitHubApi {
12- val apiToken = System .getenv(" TOKEN_GITHUB_API" ) ? : throw IllegalStateException (" GitHub API token missing" )
13-
12+ fun create (environment : Environment ): GitHubApi {
1413 val client = OkHttpClient .Builder ()
15- .addInterceptor(GitHubInterceptor (apiToken))
16- .addInterceptor(HttpLoggingInterceptor () .setLevel(HttpLoggingInterceptor .Level .BASIC ))
14+ .addInterceptor(GitHubInterceptor (environment. apiToken))
15+ .addInterceptor(HttpLoggingInterceptor { println (it) } .setLevel(HttpLoggingInterceptor .Level .BASIC ))
1716 .build()
1817
1918 val retrofit = Retrofit .Builder ()
20- .baseUrl(" https://api.github.com/repos/jraska/github-client/ " )
19+ .baseUrl(environment.baseUrl )
2120 .client(client)
2221 .validateEagerly(true )
2322 .addConverterFactory(GsonConverterFactory .create())
You can’t perform that action at this time.
0 commit comments