Vampire
01/21/2025, 10:24 AMlateinit var deploymentStep: ActionStep<DeployPages.Outputs>
job(
id = "deploy",
name = "Deploy Site",
runsOn = UbuntuLatest,
needs = listOf(buildSite),
permissions = mapOf(
Pages to Write, // to deploy to Pages
IdToken to Write // to verify the deployment originates from an appropriate source
),
environment = Environment(
name = "github-pages",
url = expr { deploymentStep.outputs.pageUrl }
)
) {
deploymentStep = uses(
name = "Deploy to GitHub Pages",
action = DeployPages()
)
}
Vampire
01/21/2025, 10:37 AMjob(
id = "deploy",
name = "Deploy Site",
runsOn = UbuntuLatest,
needs = listOf(buildSite),
permissions = mapOf(
Pages to Write, // to deploy to Pages
IdToken to Write // to verify the deployment originates from an appropriate source
),
environment = Environment(
name = "github-pages",
url = expr("steps.step-0.outputs.page_url")
)
) {
uses(
name = "Deploy to GitHub Pages",
action = DeployPages()
)
}
Piotr Krzemiński
01/21/2025, 10:45 AM_customArguments
. I don't remember why the step ID isn't customizable, maybe for simplicity: to not have to check for uniqueness? Anyway, I'm for allowing customizing step ID (here) to handle such cases. A PR is greatly welcome, and if you cannot post one, let me know - I'll do it within several days and release the lib
☝️ this may not be the most elegant solution, but I don't have a better ideaVampire
01/21/2025, 10:48 AMActionStep
instance and thus the Outputs
object. 😞Piotr Krzemiński
01/21/2025, 10:50 AMVampire
01/21/2025, 10:57 AMval deploymentStepId = "deployment"
job(
id = "deploy",
name = "Deploy Site",
runsOn = UbuntuLatest,
needs = listOf(buildSite),
permissions = mapOf(
Pages to Write, // to deploy to Pages
IdToken to Write // to verify the deployment originates from an appropriate source
),
environment = Environment(
name = "github-pages",
url = expr(DeployPages.Outputs(deploymentStepId).pageUrl)
)
) {
uses(
name = "Deploy to GitHub Pages",
action = DeployPages(),
_customArguments = mapOf(
"id" to deploymentStepId
)
)
}
Piotr Krzemiński
01/21/2025, 10:58 AMexpr(DeployPages.Outputs(deploymentStepId).pageUrl)
😄Vampire
01/21/2025, 10:59 AMActionStep
constructor that does not need the ID twice and uses
accepting an ActionStep
.
val deploymentStep = ActionStep(
id = "deployment",
name = "Deploy to GitHub Pages",
action = DeployPages()
)
job(
id = "deploy",
name = "Deploy Site",
runsOn = UbuntuLatest,
needs = listOf(buildSite),
permissions = mapOf(
Pages to Write, // to deploy to Pages
IdToken to Write // to verify the deployment originates from an appropriate source
),
environment = Environment(
name = "github-pages",
url = expr(deploymentStep.outputs.pageUrl)
)
) {
uses(deploymentStep)
}
Piotr Krzemiński
01/21/2025, 11:00 AMPiotr Krzemiński
01/21/2025, 11:01 AMVampire
01/21/2025, 11:02 AMPiotr Krzemiński
01/21/2025, 11:13 AMVampire
01/21/2025, 11:45 AMPiotr Krzemiński
01/22/2025, 7:51 AM3.1.1-20250122.074629-13
- feel free to give it a spin and let me know if you need anything else before I releasePiotr Krzemiński
01/22/2025, 8:27 AMPiotr Krzemiński
01/22/2025, 8:34 AMtypes
the last argument because named arguments aren't enforced hereVampire
01/22/2025, 8:35 AMinputs
part.
need to think to what extent it would be a breaking changeWell, same with any data class I guess which is why one shouldn't use data classes in API.
Vampire
01/22/2025, 8:35 AMVampire
01/22/2025, 8:36 AMRelease
change was breaking alreadyPiotr Krzemiński
01/22/2025, 8:39 AMAll I'm aware I need for the workflows I'm currently working on then is https://github.com/typesafegithub/github-workflows-kt/issues/614, or at least theopen to contributions here, unless you're ok with waiting several dayspart.inputs
Vampire
01/22/2025, 8:41 AMkotlin-wrappers
. 🙂
Would be nice if a Kotlin-related JetBrains project uses the lib, wouldn't it? 🙂Piotr Krzemiński
01/22/2025, 8:42 AMVampire
01/22/2025, 8:43 AM_customArguments
of course 🙂Piotr Krzemiński
01/22/2025, 8:43 AMWorkflowCall
thing needs a bit of design, so let me take a few days to thinkVampire
01/22/2025, 8:43 AMWorkflowDispatch
?Piotr Krzemiński
01/22/2025, 8:52 AMRelease
.
Regarding https://github.com/typesafegithub/github-workflows-kt/issues/614#issuecomment-2606604916, for now I'd just create a dedicated Input
class for WorkflowCall
Piotr Krzemiński
01/22/2025, 8:53 AMInput
class would be nice (like, defining inputs just once and passing them to WorkflowCall
and WorkflowDispatch
- it's a valid use case, right?), but I'd consider it in 4.xVampire
01/22/2025, 8:55 AMPiotr Krzemiński
01/22/2025, 8:55 AMVampire
01/22/2025, 8:58 AMPiotr Krzemiński
01/22/2025, 9:05 AMWorkflowDispatch.Input
in WorkflowCall
? Then we could clean it up in 4.x by moving the Input
class outside. I'm thinking if both inputs can diverge at some point - technically they canPiotr Krzemiński
01/22/2025, 9:05 AMon.workflow_dispatch.inputs.<input_id>.required
, but there's no on.workflow_call.inputs.<input_id>.required
- so they're not equal alreadyVampire
01/22/2025, 9:08 AMVampire
01/22/2025, 9:08 AMPiotr Krzemiński
01/22/2025, 9:17 AMPiotr Krzemiński
01/22/2025, 10:42 AMVampire
01/22/2025, 10:56 AMrequired
but even in 4.0 keep the input classes separate, as it is not you that controls that they stay the same but GH could any time change that.Piotr Krzemiński
01/22/2025, 11:04 AMVampire
01/22/2025, 11:25 AMVampire
01/22/2025, 11:27 AMInput
(in both cases), or called InputType
?Piotr Krzemiński
01/22/2025, 11:42 AMPiotr Krzemiński
01/22/2025, 11:50 AMPiotr Krzemiński
01/22/2025, 11:52 AMPiotr Krzemiński
01/22/2025, 11:55 AMVampire
01/22/2025, 12:23 PMPiotr Krzemiński
01/22/2025, 12:24 PMBuild / Publish snapshot (push)
. Since it doesn't log the version, I always go to https://s01.oss.sonatype.org/content/repositories/snapshots/io/github/typesafegithub/github-workflows-kt/ and check myself 😄 this time it's 3.1.1-20250122.115243-16
Piotr Krzemiński
01/22/2025, 12:31 PM3.2.0
)Vampire
01/22/2025, 12:43 PMVampire
01/22/2025, 12:43 PM@file:Repository("<https://s01.oss.sonatype.org/content/repositories/snapshots>")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:3.1.1-SNAPSHOT")
I'll tryVampire
01/22/2025, 12:45 PM3.1.1-SNAPSHOT
resolves, but does not have the new code o_OPiotr Krzemiński
01/22/2025, 12:46 PMVampire
01/22/2025, 12:46 PMVampire
01/22/2025, 12:46 PM3.1.1-20250122.115243-16
explicitly it does not work o_OPiotr Krzemiński
01/22/2025, 12:49 PMunzip github-workflows-kt-3.1.1-20250122.115243-16.jar | grep "WorkflowCall$Input"
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Secret$$serializer.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Output.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Type$Companion.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Input$$serializer.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Companion.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$$serializer.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Type.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Secret.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Output$Companion.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Input$Companion.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Output$$serializer.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Input.class
inflating: io/github/typesafegithub/workflows/domain/triggers/WorkflowCall$Secret$Companion.class
the new classes are thereVampire
01/22/2025, 12:53 PMVampire
01/22/2025, 12:53 PMVampire
01/22/2025, 12:56 PMVampire
01/22/2025, 12:56 PMPiotr Krzemiński
01/22/2025, 12:57 PMVampire
01/22/2025, 12:58 PMPiotr Krzemiński
01/22/2025, 12:58 PMVampire
01/22/2025, 1:00 PMVampire
01/22/2025, 1:00 PM$ git d .github/workflows/*.y*
diff --git a/.github/workflows/publish-github-pages.yaml b/.github/workflows/publish-github-pages.yaml
index e68927dd6..c6247bd5f 100644
--- a/.github/workflows/publish-github-pages.yaml
+++ b/.github/workflows/publish-github-pages.yaml
@@ -16,6 +16,8 @@ on:
description: 'The branch, tag or SHA to checkout. See actions/checkout ''ref''.'
type: 'string'
required: false
+ outputs: {}
+ secrets: {}
release:
types:
- 'published'
Piotr Krzemiński
01/22/2025, 1:01 PMoutputs
and secrets
if they're not set. Let me adjustVampire
01/22/2025, 1:01 PMVampire
01/22/2025, 1:02 PMexpr("inputs.checkout-ref || ${github.ref}")
Piotr Krzemiński
01/22/2025, 1:07 PMPiotr Krzemiński
01/22/2025, 1:11 PMinputs
don't behave the same way, but I don't want to break folks that have zero-input workflows...Vampire
01/22/2025, 1:14 PMevent.inputs.version
in the work-around while afaiu it should be inputs.version
,
and he does not declare an input called version
but an input called RELEASE_VERSION
.
And the suggested solution with "After the change, the inputs wouldn't be defined here" might be sub-par as inputs can come from WorkflowDispatch
or WorkflowCall
afaiu.Vampire
01/22/2025, 1:15 PMContexts.workflowDispatchInput
and Contexts.workflowCallInput
.
Both might have different inputs.Piotr Krzemiński
01/22/2025, 1:16 PMPiotr Krzemiński
01/22/2025, 1:17 PMoutputs
and secrets
if they're not set, so feel free to try the snapshot once it appears in a few minutes, and let me know if you see any other rough edges!Vampire
01/22/2025, 1:50 PMVampire
01/22/2025, 1:51 PMVampire
01/22/2025, 2:00 PMPiotr Krzemiński
01/22/2025, 2:45 PM_Untyped
from class name, right?Vampire
01/22/2025, 2:45 PMVampire
01/22/2025, 2:47 PMPiotr Krzemiński
01/22/2025, 2:51 PM_Untyped
wrappersPiotr Krzemiński
01/22/2025, 2:52 PMVampire
01/22/2025, 3:10 PMPiotr Krzemiński
01/22/2025, 3:10 PMVampire
01/22/2025, 3:11 PMVampire
01/22/2025, 4:24 PMVampire
01/22/2025, 4:24 PMVampire
01/22/2025, 4:36 PMVampire
01/22/2025, 4:40 PMPiotr Krzemiński
01/22/2025, 5:14 PMPiotr Krzemiński
01/22/2025, 5:18 PMPiotr Krzemiński
01/22/2025, 5:19 PMVampire
01/22/2025, 5:20 PMVampire
01/22/2025, 5:32 PMVampire
01/22/2025, 5:32 PM> Task action binding generatortest
io.github.typesafegithub.workflows.actionbindinggenerator.typing.TypesProvidingTest > copes with comment-only typing FAILED
com.charleskorn.kaml.EmptyYamlDocumentException at TypesProvidingTest.kt:35
Piotr Krzemiński
01/22/2025, 5:36 PMVampire
01/22/2025, 5:37 PMVampire
01/22/2025, 5:38 PMPiotr Krzemiński
01/22/2025, 6:48 PMVampire
01/22/2025, 7:05 PMPiotr Krzemiński
01/22/2025, 7:48 PMPiotr Krzemiński
01/22/2025, 8:05 PMVampire
01/22/2025, 9:03 PM