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

Schema validation issues found in action.yml for two "default" values #747

Open
Coderrob opened this issue Feb 9, 2025 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@Coderrob
Copy link

Coderrob commented Feb 9, 2025

Description:
Using Action schema with YAML validation I was running a self-documentation test for another action. It noticed and failed validation for the setup-java repo's action.yml because of two invalid "default" field values where a boolean value was set where a string value is expected.

Repro steps:
Your repo.

Image
Image

Expected behavior:
The action.yml should be schema validated.

Actual behavior:
The action.yml is not schema validated.

Opened a PR with the minor changes => #746

@Coderrob Coderrob added bug Something isn't working needs triage labels Feb 9, 2025
@gowridurgad
Copy link

Hello @Coderrob ,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

@gowridurgad gowridurgad self-assigned this Feb 10, 2025
@gowridurgad
Copy link

Hi @Coderrob, Thank you for bringing this up. It appears that the issue you're encountering is due to a mismatch between the expected data types in the schema you are using for validation. The default field in our action.yml specifies a boolean value, which is valid within the context of our implementation. We are not experiencing any errors or issues on our end with this configuration. However, it is possible that the schema you are using for validation expects a string value for the default field. This may be the root cause of the discrepancy.
We recommend reviewing the schema's specifications to ensure it aligns with the intended design of the action.yml. If you're still facing issues, could you please share the schema or any additional details that could help us investigate further? We'd be happy to assist.

@gowridurgad
Copy link

Hi @Coderrob, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.

@Coderrob
Copy link
Author

Coderrob commented Feb 26, 2025

@gowridurgad - I verified with the official Microsoft GitHub Actions documentation and "default" values are expected to be in string format, which is the reason why VSCode was flagging the boolean as invalid for the properties value:

https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#inputsinput_iddefault

inputs.<input_id>.default
Optional A string representing the default value. The default value is used when an input parameter isn't specified in a workflow file.


The defaults should be changed to 'true' or 'false' to be compliant with YAML schema validation checks.

All the "input" field values get changed into strings. They're all backed by ENV variables, which are all strings. That's why there is a getBooleanInput added to the @actions/core library. It does the conversion from string => boolean so no additional parsing is needed.

The schema definition that was flagging the fields mentioned in the issue is directly from VSCode using the GitHub Actions Workflow schema hosted in the json.schemastore.org. You can see the schema expectations as well:

https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
https://json.schemastore.org/github-action.json

Image

Ultimately if you all don't want to change it, that's a valid life choice, just wanted to point out that schema validators will fail because of the invalid data type format. The action will do what it does now without issue because it's converted to string eventually.

Just lemme know. I can close this or you may as well if it's a no-op from your side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants