Skip to content

Commit abf4cbf

Browse files
Issue #20749 - Migrate create-branch to ziro-cli (PR #31)
* Add query to get current user ID * Add more fields to query return value * Rename function * Make issue fragment board agnostic * Add state * Change version to major version
1 parent 4c716e8 commit abf4cbf

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

src/main/graphql/github/schema.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/main/graphql/zenhub/fragments/IssueFragment.graphql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ fragment IssueFragment on Issue {
5656
}
5757
}
5858
}
59-
pipelineIssue(workspaceId: "59c54eb49d9e774e473597f1") {
60-
pipeline {
61-
name
59+
pipelineIssues {
60+
nodes {
61+
pipeline {
62+
name
63+
}
6264
}
6365
}
6466
parentIssue {
@@ -72,4 +74,5 @@ fragment IssueFragment on Issue {
7274
description
7375
}
7476
}
77+
state
7578
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
query GetCurrentUser {
2+
viewer {
3+
githubUser {
4+
id
5+
login
6+
}
7+
}
8+
}

src/main/graphql/zenhub/schema.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/main/kotlin/zenhub/ZenHubClient.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import com.ziro.engineering.zenhub.graphql.sdk.*
66
import com.ziro.engineering.zenhub.graphql.sdk.type.*
77
import java.time.Instant
88
import java.time.LocalDate
9-
import kotlin.collections.toSet
10-
import kotlin.streams.toList
119
import kotlinx.coroutines.flow.single
1210
import kotlinx.coroutines.runBlocking
1311
import okhttp3.internal.closeQuietly
@@ -633,7 +631,7 @@ class ZenHubClient(val zenhubWorkspaceId: String = DEFAULT_WORKSPACE_ID) : AutoC
633631
labelIds: List<String>?
634632
): List<SearchClosedIssuesQuery.Node> = runBlocking {
635633
val labels: Optional<StringInput?> =
636-
if (labelIds == null || labelIds.isEmpty()) {
634+
if (labelIds.isNullOrEmpty()) {
637635
Optional.absent()
638636
} else {
639637
Optional.present(StringInput(`in` = Optional.present(labelIds)))
@@ -664,6 +662,11 @@ class ZenHubClient(val zenhubWorkspaceId: String = DEFAULT_WORKSPACE_ID) : AutoC
664662
trimResults(results, startTime, endTime)
665663
}
666664

665+
fun getCurrentUser(): GetCurrentUserQuery.GithubUser? = runBlocking {
666+
val query = GetCurrentUserQuery()
667+
apolloClient.query(query).toFlow().single().data?.viewer?.githubUser
668+
}
669+
667670
private fun searchClosedIssues(
668671
filters: IssueSearchFiltersInput,
669672
after: String?

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.0.0
1+
7.0.0

0 commit comments

Comments
 (0)