|
1 | 1 | package io.github.typesafegithub.workflows.dsl |
2 | 2 |
|
3 | 3 | import io.github.typesafegithub.workflows.actions.actions.Checkout |
| 4 | +import io.github.typesafegithub.workflows.actions.actions.DeployPages |
4 | 5 | import io.github.typesafegithub.workflows.actions.actions.SetupJava |
5 | 6 | import io.github.typesafegithub.workflows.actions.actions.SetupJava.Distribution.Adopt |
| 7 | +import io.github.typesafegithub.workflows.domain.ActionStep |
| 8 | +import io.github.typesafegithub.workflows.domain.Environment |
6 | 9 | import io.github.typesafegithub.workflows.domain.RunnerType |
7 | 10 | import io.github.typesafegithub.workflows.domain.Workflow |
8 | 11 | import io.github.typesafegithub.workflows.domain.triggers.Push |
| 12 | +import io.github.typesafegithub.workflows.dsl.expressions.expr |
9 | 13 | import io.kotest.assertions.throwables.shouldThrow |
10 | 14 | import io.kotest.core.spec.style.FunSpec |
11 | 15 | import io.kotest.engine.spec.tempdir |
@@ -209,4 +213,36 @@ class JobBuilderTest : |
209 | 213 | } |
210 | 214 | } |
211 | 215 | } |
| 216 | + |
| 217 | + test("action output passed to environment") { |
| 218 | + // When |
| 219 | + var workflow: Workflow? = null |
| 220 | + workflow( |
| 221 | + name = "test", |
| 222 | + on = listOf(Push()), |
| 223 | + sourceFile = sourceTempFile, |
| 224 | + useWorkflow = { workflow = it }, |
| 225 | + ) { |
| 226 | + val deploymentStep = |
| 227 | + ActionStep( |
| 228 | + id = "deployment", |
| 229 | + name = "Deploy to GitHub Pages", |
| 230 | + action = DeployPages(), |
| 231 | + ) |
| 232 | + job( |
| 233 | + id = "deploy", |
| 234 | + runsOn = RunnerType.UbuntuLatest, |
| 235 | + environment = |
| 236 | + Environment( |
| 237 | + name = "github-pages", |
| 238 | + url = expr(deploymentStep.outputs.pageUrl), |
| 239 | + ), |
| 240 | + ) { |
| 241 | + uses(actionStep = deploymentStep) |
| 242 | + } |
| 243 | + } |
| 244 | + |
| 245 | + // Then |
| 246 | + workflow!!.jobs[0].environment?.url shouldBe "${'$'}{{ steps.deployment.outputs.page_url }}" |
| 247 | + } |
212 | 248 | }) |
0 commit comments