github-workflows-kt icon indicating copy to clipboard operation
github-workflows-kt copied to clipboard

[Bug] `Contexts.env` result misses the `env.` prefix

Open Vampire opened this issue 8 months ago • 2 comments

Component

  • [x] github-workflows-kt (library with the DSL)
  • [ ] bindings server (https://bindings.krzeminski.it)
  • [ ] I don't know

Action

val FOO by Contexts.env

and then using it

Expected

env.FOO is used

Actual

FOO is used

Version

3.4.0

Vampire avatar May 11 '25 17:05 Vampire

There are actually 3 things wrong here:

  1. Contexts.env wasn't meant to be used with GitHub Actions env context, but instead as a type-safe way to refer to the env vars from shell. We don't have support for env context, and we probably should under Contexts.env. For type-safe referring from shell, we should have some other mechanism.
  2. Even with the assumption that Contexts.env is for shell, the usage shown in the tests: https://github.com/typesafegithub/github-workflows-kt/blob/8005a2e446b7c80cabb68ea9022b3fb2d87ef973/.github/workflows/end-to-end-tests.main.kts#L75-L77 produces this:
    env:
      $GREETINGS: World
    
    - it should be without the dollar sign.
  3. The tests don't have any assertion on the correct interpolation e.g. here: https://github.com/typesafegithub/github-workflows-kt/blob/8005a2e446b7c80cabb68ea9022b3fb2d87ef973/.github/workflows/end-to-end-tests.main.kts#L191

krzema12 avatar May 11 '25 20:05 krzema12

Oh, yeah, that's quite confusing then right now.

Vampire avatar May 11 '25 21:05 Vampire