https://kotlinlang.org logo
#github-workflows-kt
Title
# github-workflows-kt
l

LeoColman

12/05/2023, 2:24 AM
I'm not even exactly sure how to report this:
Copy code
... types from <https://raw.githubusercontent.com/gradle/gradle-build-action/v2//action-types.yaml>
  ... types from <https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/main/typings/gradle/gradle-build-action/v2//action-types.yml>
java.lang.IllegalArgumentException: Request contains invalid properties:
Available: [gradle-version, gradle-executable, build-root-directory, cache-disabled, cache-read-only, cache-write-only, cache-overwrite-existing, gradle-home-cache-includes, gradle-home-cache-excludes, arguments, generate-job-summary, dependency-graph, gradle-home-cache-strict-match, workflow-job-context, gradle-home-cache-cleanup, github-token]
Invalid:   [artifact-retention-days]
        at io.github.typesafegithub.workflows.actionbindinggenerator.GenerationKt.checkPropertiesAreValid(Generation.kt:86)
        at io.github.typesafegithub.workflows.actionbindinggenerator.GenerationKt.generateBinding(Generation.kt:52)
        at io.github.typesafegithub.workflows.actionbindinggenerator.GenerationKt.generateBinding$default(Generation.kt:40)
        at io.github.typesafegithub.workflows.actionbindinggenerator.GenerateActionBindingsCliHelperKt.generateActionBindings(GenerateActionBindingsCliHelper.kt:39)
        at Generate_action_bindings_main.<init>(generate-action-bindings.main.kts:6)
When running
Copy code
#!/usr/bin/env kotlin
@file:DependsOn("io.github.typesafegithub:action-binding-generator:1.6.0")

import io.github.typesafegithub.workflows.actionbindinggenerator.generateActionBindings

generateActionBindings(args)
on Petals
v

Vampire

12/05/2023, 3:23 AM
That was added to both sides a couple of days ago. Maybe something is cached and the other not?
p

Piotr Krzemiński

12/05/2023, 6:55 AM
@LeoColman I think the problem may be in the cached action.yml. If you attached some more log lines (before fetching the typings), we could confirm it
Ok, got this - found a bug (hopefully it's the one you observe 😁). Thanks for reporting @LeoColman! I'll fix it within several days. As a mitigation on your side, please remove
build/action-yaml
and
build/action-types-yaml
. The GitHub Actions runs aren't affected because the cache stste is not stored anywhere between the runs.
github workflows kt 1
I decided to remove caching altogether (at least for now, in the current form), it creates too much problems compared to benefits. This change will enter the next release this Friday, I guess there's no need to release a patch version outside of the schedule since there's an easy workaround
👍 1
l

LeoColman

12/05/2023, 12:56 PM
No problem! I'm still in early adopter team! blob sunglasses
kodee happy 1
thank you color 1
p

Piotr Krzemiński

12/05/2023, 12:59 PM
One by one, we're gonna catch 'em all (bugs) :D
🫶 1
@LeoColman just to make sure: has the workaround done the job?
l

LeoColman

12/05/2023, 1:19 PM
Yes. Resetting
build
makes it work again
It's still generating Java V3 instead of V4, for some reason
p

Piotr Krzemiński

12/05/2023, 1:28 PM
do you have a reproducer I can try out locally?
l

LeoColman

12/05/2023, 1:28 PM
Petals App, I suppose
It's where I'm trying to run. I'm running on a blank copy of
main
Copy code
RegularAction<SetupJava.Outputs>("actions", "setup-java", _customVersion ?: "v4")
It's generating the right v4, it seems
But it's putting v3 on the yaml
If I just ship it to Github without the change to v3 it works
It's something still locally kept
Copy code
... from cache: build/action-yaml/actions-setup-java-v4.yml
  ... types from <https://raw.githubusercontent.com/actions/setup-java/v4//action-types.yml>
  ... types from <https://raw.githubusercontent.com/actions/setup-java/v4//action-types.yaml>
  ... types from <https://raw.githubusercontent.com/typesafegithub/github-actions-typing-catalog/main/typings/actions/setup-java/v4//action-types.yml>
It gets the right version when running
generate-action-bindings.main.kts
p

Piotr Krzemiński

12/05/2023, 1:33 PM
Try purging the Kotlin Script cache
Or making a dummy change in the workflow script and rerunning it
👍 1
l

LeoColman

12/05/2023, 1:34 PM
I'm not sure how to purge KTS cache tho
l

LeoColman

12/05/2023, 1:36 PM
Making a dummy change works
Interestingly, undoing my dummy change breaks it again
v

Vampire

12/05/2023, 1:38 PM
Yes, because it then is taken from the cache again
👍 1
l

LeoColman

12/05/2023, 1:39 PM
In GitHub it has no issues, but as it is I'm 'able' to commit a bad workflow file @Piotr Krzemiński
p

Piotr Krzemiński

12/05/2023, 1:41 PM
The consistency check job should catch it, isn't it failing?
v

Vampire

12/05/2023, 1:42 PM
Read the last bulletpoint here: https://github.com/spockframework/spock/blob/8e2af28d3dd5c2f0d8340e5df16c9fd254992936/.github/workflows/README.adoc, that should make the problem pretty clear and provide mitigation strategies
👍 1
l

LeoColman

12/05/2023, 1:42 PM
Yes, it catches it. The problem is that it's inconsistent with what is locally available. For instance, I have to remove the
v4
->
v3
from the commit, or else it fails in the consistency check
v

Vampire

12/05/2023, 1:45 PM
My message was for you @LeoColman if that wasn't clear 🙂
👍 1
❤️ 1
l

LeoColman

12/05/2023, 1:46 PM
Spock is using workflows-kts!
Cooool!
I'm a #kotest guy, but I love spock 😄
v

Vampire

12/05/2023, 1:47 PM
Not yet, waiting for Leonard to finally accept and merge it. That's just the state of the file in my PR
👍 2
p

Piotr Krzemiński

12/05/2023, 1:50 PM
@LeoColman LMK if there's still something actionable on me :) unfortunately we need to deal with some rough edges on the Kotlin side. I tried to fix this bug with importing myself, but after reading the current code I gave up and just created a reproducing unit test in the Kotlin repo
👍 1
Once Kotlin 2.0 is out, I'm going to remind the Kotlin team to revisit several bugs related to Kotlin scripting
👍 1
👍🏼 1
l

LeoColman

12/05/2023, 1:53 PM
As an actionable action, maybe add to the documentation this kind of problem - if it's not already there - with the workarounds as well
Also requesting people to +1 the ticket, but I think you've done it already 😛
p

Piotr Krzemiński

12/05/2023, 1:57 PM
I'm thinking about adding a FAQ section in the docs that would include e. g. this problem. Regarding requesting +1s, yeah, I don't want to be too pushy. I'll include links to YouTrack in the FAQ
👍 1
Feel free to add a comment here with anything that you think would be worth describing in the FAQ, like non-obvious design/behavior, known issues or anything problematic from your PoV
👍 1