Skip to content
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

Export composable types #3

Open
moltar opened this issue Aug 15, 2022 · 1 comment
Open

Export composable types #3

moltar opened this issue Aug 15, 2022 · 1 comment

Comments

@moltar
Copy link

moltar commented Aug 15, 2022

First of all, a really nice package! Thanks for that. 🙌🏼


Now, to the actual issue...

Since the entire point of defining "as code" is to be able to reuse chunks of definitions. I feel like then types need to be exported for each chunk that can be reused.

For example, there is no exported type for a step, and even trying to do various TypeScript acrobatics to infer the type, it won't work, since the step type is a complicated union.

I think each composable type needs to be exported.

At least:

  • Step
  • Job
  • Workflow

Or factory functions, like createWorkflow.

At the same time, there are many types that are exported, which are not needed.

image

@adrians5j
Copy link
Member

adrians5j commented Nov 4, 2022

Actually, these types are built via this script here: https://github.com/webiny/github-actions-wac/blob/main/scripts/generateGithubActionsWorkflowTypes.ts

So, it's reading https://json.schemastore.org/github-workflow.json and converting that into TS. No manual steps done.

When it comes to types, you can import them actually:

  • job: NormalJob['steps']
  • step: NormalJob
  • workflow - Workflow

image

So, just import from the package, like:

import { NormalJob, Workflow } from "github-actions-wac";

Hope that helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants