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

Default value not used ? #111

Closed
fletort opened this issue Oct 31, 2024 · 11 comments
Closed

Default value not used ? #111

fletort opened this issue Oct 31, 2024 · 11 comments
Assignees

Comments

@fletort
Copy link

fletort commented Oct 31, 2024

I think that default value seems not to be used for input, right ?
It should be possible to add this ?
It should be interresting to can test these default value behaviour from the cli.

@ncalteen
Copy link
Collaborator

At the moment, no default values are used. I can definitely set these!

For now, I will set them to assume that the user is running local-action from the directory containing the action repository, so:

local-action run . src/main.ts .env

@ncalteen
Copy link
Collaborator

Hmm....actually on second thought I think I might hold off on this. The issue is the tool doesn't currently know the type of action being run (JavaScript or TypeScript...or hopefully eventually container/composite).

@ncalteen ncalteen self-assigned this Oct 31, 2024
@theoephraim
Copy link
Contributor

theoephraim commented Jan 7, 2025

This was very unexpected - and it means we must explicitly pass in all the defaults again.
Regardless of the action type, I think it should respect those defaults defined in the action.yaml file.

@ncalteen
Copy link
Collaborator

ncalteen commented Jan 7, 2025

Apologies, I think I misunderstood the original intent of the request. I was assuming this meant the defaults for the local-action command itself, not the default inputs in the action.yml file. I can certainly add that in!

@ncalteen ncalteen reopened this Jan 7, 2025
@ncalteen
Copy link
Collaborator

ncalteen commented Jan 7, 2025

This should do the trick: #139

v2.5.0 should be available on npm shortly. Please open an issue if you see any problems!

@ncalteen ncalteen closed this as completed Jan 7, 2025
@theoephraim
Copy link
Contributor

Awesome - thanks!

With this now working, I'm not sure if having a .env file is always necessary. Might want to remove that requirement?

@ncalteen
Copy link
Collaborator

ncalteen commented Jan 7, 2025

I would say yes but there are a bunch of other configuration flags in there, not including inputs.

@theoephraim
Copy link
Contributor

Totally - but they are not required, and can be passed in via actual env vars. Currently I'm only using inputs in mine, so once this lands, I'll have the requirement of creating an empty .env file which feels a bit weird.

@theoephraim
Copy link
Contributor

theoephraim commented Jan 7, 2025

Also! Getting an error now ::error::EnvMeta.inputs[name].default.trim is not a function
not sure if it's because something is empty or its trying to trim a boolean.

@theoephraim
Copy link
Contributor

ok - confirmed that the issue is that the default value coming through is a boolean
The yaml treatsdefault: true and default: 'true' differently. The TS type and your related test assume it's always coming through as a string.

@ncalteen
Copy link
Collaborator

ncalteen commented Jan 8, 2025

Can we open a separate issue to track this?

FYI the GitHub YAML schema expects a string value. This is also documented in the action syntax documentation.

Edit: I will follow up in the open PR and we can discuss there :)

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

3 participants