question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create a tool for providing typings for action inputs and outputs

See original GitHub issue

Problem statement

Currently it’s challenging to add support for multiple new actions. Each new action requires checking its inputs and inferring their types which then land in WrappersToGenerate.kt. Sometimes they are provided by the authors in README, sometimes they are inferred from input’s description or type of default value. It doesn’t scale well, introduces a risk of human error and adds operational load for actions already supported if they get new inputs.

Proposed solution

We should encourage action owners to proactively provide types for their actions’ APIs in a standardized manner. The proposed approach is to have a GitHub action that would read action’s manifest (action.y(a)ml) and would validate an extra type attribute for each input and output. This DSL library currently generates type-safe API only for inputs, but in the future the outputs can be type-safe as well.

Once such approach becomes popular, an automated job could proactively scan GitHub for actions using the typing validation action mentioned above, and add it to the list of requested wrappers. In the future, once Kotlin compiler plugins are easier to use from Kotlin scripting, I can imagine generating necessary wrapper code using such plugin, which would remove the need to maintain wrappers code in the library.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jmfayardcommented, Jun 22, 2022

I thought https://github.com/krzema12/github-actions-kotlin-dsl/pull/308 would make it easy to submit pull requests 😃

1reaction
krzema12commented, Jun 22, 2022

@Vampire great feedback, thanks! Yeah, I get your concern, I also thought about it. The major reason why I decided to put type info in existing action.yml is that this is the source of truth for action inputs and outputs. Now we have a trade-off: for now the schema validators will report type-related fields as incorrect, but in return the action manifest is self-contained and you don’t have to jump between two files to read full information about a given input/output. My hope is that this kind of spec will lead GitHub to introducing something similar (that’s why I wrote “for now”), but it may happen or not - no hard assumptions here.

Now when I think of it, what you propose is a reasonable compromise. Additionally I’d implement a piece of logic that ensures all inputs and outputs defined in action.yml are also present in action-types.yml.

@jmfayard how does it sound to you?

More action owners’ feedback greatly welcome here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Metadata syntax for GitHub Actions - GitHub Docs
The data in the metadata file defines the inputs, outputs, and runs configuration for your action. Action metadata files use YAML syntax.
Read more >
Creating Custom GitHub Actions - This Dot Labs
In this article, we will learn how to create our first custom Github Actions using Typescript. We will also show some of the...
Read more >
Action input and output data types - ServiceNow Docs
The inputs and outputs of an action are variables. Each variable has a data type that determines what data it stores and its...
Read more >
Writing a GitHub Action in TypeScript from Scratch - Nils Braun
We will build a small GitHub action with TypeScript in this post! Introduction. GitHub actions is the new CI/CD tool and it comes...
Read more >
@actions/core - npm
Outputs can be set with setOutput which makes them available to be mapped into inputs of other actions to ensure they are decoupled....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found