-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fe6fa1
commit de36184
Showing
15 changed files
with
131 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
flank-scripts/src/main/kotlin/flank/scripts/github/commons/LastWorkflowRunDate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package flank.scripts.github.commons | ||
|
||
import com.github.kittinunf.result.getOrNull | ||
import flank.scripts.github.getGitHubWorkflowRunsSummary | ||
import flank.scripts.github.objects.GitHubWorkflowRun | ||
import java.time.Instant | ||
import java.time.format.DateTimeFormatter | ||
|
||
suspend fun getLastWorkflowRunDate( | ||
token: String, | ||
workflowName: String? = null, | ||
workflowFileName: String? = null | ||
): String = getGitHubWorkflowRunsSummary( | ||
githubToken = token, | ||
workflow = requireNotNull( | ||
workflowName ?: workflowFileName | ||
) { "** Missing either workflow name or workflow file name. Both can not be null" }, | ||
parameters = listOf( | ||
"per_page" to 20, | ||
"page" to 1 | ||
) | ||
).getOrNull() | ||
?.run { | ||
workflowRuns | ||
.filter { it.status != "in_progress" } | ||
.filter { it.conclusion != "cancelled" } | ||
.getOrNull(0) | ||
.logRun() | ||
?.createdAt.run { DateTimeFormatter.ISO_INSTANT.format(Instant.parse(this)) } | ||
} ?: run { | ||
println("** No workflow run found for ${workflowName ?: workflowFileName}") | ||
DateTimeFormatter.ISO_INSTANT.format(Instant.now()) | ||
} | ||
|
||
private fun GitHubWorkflowRun?.logRun() = this?.also { | ||
println( | ||
""" | ||
** Last workflow run: | ||
name: ${it.name} | ||
last run: ${it.createdAt} | ||
url: ${it.htmlUrl} | ||
""".trimIndent() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 1 addition & 42 deletions
43
flank-scripts/src/main/kotlin/flank/scripts/integration/WorkflowSummary.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,8 @@ | ||
package flank.scripts.integration | ||
|
||
import com.github.kittinunf.result.getOrNull | ||
import flank.scripts.github.getGitHubWorkflowRunsSummary | ||
import flank.scripts.github.objects.GitHubWorkflowRun | ||
import java.time.Instant | ||
import java.time.format.DateTimeFormatter | ||
import flank.scripts.github.commons.getLastWorkflowRunDate | ||
|
||
suspend fun getLastITWorkflowRunDate(token: String) = getLastWorkflowRunDate( | ||
token = token, | ||
workflowFileName = "full_suite_integration_tests.yml" | ||
) | ||
|
||
suspend fun getLastWorkflowRunDate( | ||
token: String, | ||
workflowName: String? = null, | ||
workflowFileName: String? = null | ||
): String = getGitHubWorkflowRunsSummary( | ||
githubToken = token, | ||
workflow = requireNotNull( | ||
workflowName ?: workflowFileName | ||
) { "** Missing either workflow name or workflow file name. Both can not be null" }, | ||
parameters = listOf( | ||
"per_page" to 20, | ||
"page" to 1 | ||
) | ||
).getOrNull() | ||
?.run { | ||
workflowRuns | ||
.filter { it.status != "in_progress" } | ||
.filter { it.conclusion != "cancelled" } | ||
.getOrNull(0) | ||
.logRun() | ||
?.createdAt.run { DateTimeFormatter.ISO_INSTANT.format(Instant.parse(this)) } | ||
} ?: run { | ||
println("** No workflow run found for ${workflowName ?: workflowFileName}") | ||
DateTimeFormatter.ISO_INSTANT.format(Instant.now()) | ||
} | ||
|
||
private fun GitHubWorkflowRun?.logRun() = this?.also { | ||
println( | ||
""" | ||
** Last workflow run: | ||
name: ${it.name} | ||
last run: ${it.createdAt} | ||
url: ${it.htmlUrl} | ||
""".trimIndent() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ell/firebase/GenerateJavaClientCommand.kt → ...se/apiclient/GenerateJavaClientCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/shell/firebase/UpdateApiJsonCommand.kt → ...irebase/apiclient/UpdateApiJsonCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../flank/scripts/pullrequest/ZenHubIssue.kt → ...otlin/flank/scripts/zenhub/ZenHubIssue.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.