-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add typings and validation workflow #257
Conversation
Cześć @krzema12 Thanks for your contribution! I've looked into your typing action and I'm not fully sold on it yet. Could you explain what are the benefits of it? For now it looks like another place to remember to update types definitions as I still need to maintain TS types (especially for enums). Would it be possible to just try and use the existing TS types if possible (I could modify how I structure the types if necessary) Let me know :) I'll be back in PL tomorrow night (and in GDA over the weekend) if you would like to discuss |
Hi @ktrz! The goal here is to have a programming language-agnostic, easy-to-parse typings in a standardized format. This format is already used by a bunch of actions. For now the only tool I know that makes use of these typings is https://github.com/typesafegithub/github-workflows-kt. For actions that don't yet provide typings, there's https://github.com/typesafegithub/github-actions-typing-catalog (also for this action: https://github.com/typesafegithub/github-actions-typing-catalog/blob/main/typings/benchmark-action/github-action-benchmark/v1/action-types.yml). Why not TS typings? Because the TS layer is merely an implementation detail using a particular programming language, and it's challenging to parse these in a generic and scalable way because one can implement action's logic even in some exotic languages. What you could try to do to make things easier to maintain is to have a piece of logic that asserts on equivalence of TS types and action-typing.yml, or maybe auto-commits updates to the YAML based on changes in TS. Think of it as exporting action's types in a standardized form. What a coincidence that you'll visit Gdansk 😊 This time I won't manage to meet, unfortunately. |
Fun fact: even Microsoft uses it 😎 https://github.com/microsoft/setup-msbuild/blob/main/action-types.yml Just without the validating action. |
Hi @ktrz, let's resume our discussion here, I'm wondering that you think about what I wrote. |
Hey @krzema12 Additionally, as far as I understand it is meant to be used alongside a released action. In the case of this action, we build and push the action to a different branch --> |
So far the only consumer of the typings I'm aware of is https://github.com/typesafegithub/github-workflows-kt, and thanks to the typings we get type-safety when using actions from Kotlin. I'm not aware of any tool that would perform validation if one uses a YAML-based workflow, and I think it would be a good idea to create such tool, but for now it's beyond the scope of what I'm planning to work on since right now I'm focused on the Kotlin DSL way of consuming the actions. I hope that someone from the community will see a potential in this approach and will add some validation facilities to the YAML approach, or maybe even GitHub will consider adding it as a first-party feature.
Yes, that's right. The typings should be co-located with action.yml, and indeed you'll likely need to adjust your release process. |
Ok @krzema12 |
@krzema12 could you please run |
thank you @krzema12 for your contribution! |
@ktrz thanks as well! Really hoping this standard gets more and more adoption. BTW, are you planning to release a version with the typings somehow soon? |
I'll release it in the coming days. Need to check other outstanding PRs. Will let you know |
@ktrz maybe a good idea for another project from you :-D |
☝️ I'd be happy to host such tool under the typesafegithub org! |
Friendly ping - would you be able to release? |
Add typings using https://github.com/typesafegithub/github-actions-typing, so that other tools can make use of them.