Damien O'Hara
02/13/2023, 1:39 PMgithub-workflows-kt but I am not sure how to tackle the line url: ${{ steps.deployment.outputs.page_url }}. I don't mind hard coding it in a _customArgument it but I don't see a way to provide the deployment step id to that deployment step. hard-coding the generated id (e.g. step-4) seems brittle since the ids are positional. any thoughts on the best approach here?Piotr Krzemiński
02/13/2023, 1:40 PMPiotr Krzemiński
02/13/2023, 1:40 PMPiotr Krzemiński
02/13/2023, 1:41 PMDamien O'Hara
02/13/2023, 1:47 PMVampire
02/13/2023, 1:50 PMurl then used?Piotr Krzemiński
02/13/2023, 1:50 PMenvironment, so before the steps run?Damien O'Hara
02/13/2023, 1:52 PMVampire
02/13/2023, 1:59 PMDamien O'Hara
02/13/2023, 2:17 PMPiotr Krzemiński
02/13/2023, 2:19 PMVampire
02/13/2023, 2:20 PMVampire
02/13/2023, 2:28 PMenv on WorkflowBuilder like there is on JobBuilder, but you can already do itVampire
02/13/2023, 2:29 PMlateinit var deployment: ExternalActionStepWithOutputs<CustomAction.Output>
workflow(
...
) {
job(...) {
deployment = uses(
action = CustomAction(
actionOwner = "actions",
actionName = "deploy-pages",
actionVersion = "v1",
inputs = mapOf()
)
)
}
}.apply {
env["url"] = expr(deployment.outputs["page_url"])
writeToFile()
}Vampire
02/13/2023, 2:31 PMenv on WorkflowBuilder too, you could instead do the nicer
workflow(
...
) {
lateinit var deployment: ExternalActionStepWithOutputs<CustomAction.Output>
job(...) {
deployment = uses(
action = CustomAction(
actionOwner = "actions",
actionName = "deploy-pages",
actionVersion = "v1",
inputs = mapOf()
)
)
}
env["url"] = expr(deployment.outputs["page_url"])
}.writeToFile()
or even the neat
workflow(
...
) {
job(...) {
val deployment = uses(
action = CustomAction(
actionOwner = "actions",
actionName = "deploy-pages",
actionVersion = "v1",
inputs = mapOf()
)
)
this@workflow.env["url"] = expr(deployment.outputs["page_url"])
}
}.writeToFile()Vampire
02/13/2023, 2:56 PMDamien O'Hara
02/13/2023, 3:02 PMVampire
02/13/2023, 3:36 PMDamien O'Hara
02/13/2023, 3:59 PMurl on jobs.<job_id>.environment. this environment field is different to the env field on jobs and workflows. I think it could only be provided through _customArguments at the momentVampire
02/13/2023, 4:01 PMworkflow(
...
) {
job(...) {
val deployment = uses(
action = CustomAction(
actionOwner = "actions",
actionName = "deploy-pages",
actionVersion = "v1",
inputs = mapOf()
)
)
env["url"] = expr(deployment.outputs["page_url"])
}
}.writeToFile()Damien O'Hara
02/13/2023, 4:03 PMenvironment or env?Vampire
02/13/2023, 4:12 PMenv with environment (damn you GitHub)Vampire
02/13/2023, 4:12 PMenv variablesVampire
02/13/2023, 4:13 PMenvironment key is not supported by this lib yet, so you should definitely open a feature request if there is none yetDamien O'Hara
02/13/2023, 4:13 PMjob._customArguments after the step builder similar to how env["url"] is set above?Damien O'Hara
02/13/2023, 4:14 PMVampire
02/13/2023, 4:15 PMjob() call currentlyDamien O'Hara
02/13/2023, 4:25 PM_customArguments
workflow(
"Test Workflow",
on = listOf(Push())
) {
val jobCustomArguments = mutableMapOf<String, Any?>()
job("test-job",
runsOn = RunnerType.UbuntuLatest,
_customArguments = jobCustomArguments
) {
val deployment = uses(CustomAction(
actionOwner = "actions",
actionName = "deploy-pages",
actionVersion = "v1",
inputs = mapOf()
))
jobCustomArguments["environment"] = mapOf(
"url" to expr(deployment.outputs["page_url"])
)
}
}